Since of Services module the api key is needed in HTTP headers instead of in URL.

We need this module to be able to support that HTTP header.

Comments

ChristianWespire created an issue. See original summary.

ChristianWespire’s picture

StatusFileSize
new1.2 KB

Created a patch for review

lquessenberry’s picture

@ChristianWespire Do you mind giving an example of how this works? I am interested.

ChristianWespire’s picture

This patch adds a field to the views_json_query settings page (in a view) where you can fill in an api key. This api key will be sent as header with the HTTP request to the endpoint.

This is useful when you have another Drupal instance with services enabled, and you want to use this module to decode the JSON. If you use Services API Token Authentication as authentication procedure, you need to sent an API-KEY with the HTTP header.

lquessenberry’s picture

@ChristianWespire

This doesn't seem to want to work for me unfortunately. The only way I can get it to work is to append the API key as an argument in the URL.

ChristianWespire’s picture

That will work as well, but if you update Services module to the latest version, passing the API key via the URL isn't supported anymore.

mpaler’s picture

Thanks for this patch, works perfectly, except new field isn't exportable. I've re-rolled it to include declaration of new form field so it's picked up by Features/view export.

mpaler’s picture

One more re-roll tweak so you don't need to save an API key into your codebase, but rather you can set it via a variable_set (or similar method).

mpaler’s picture

Three's a charm. Please use this patch. Permits using both variable_set or UI to set API key.