Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can't access the api with header "Content-Type"

Hi,

When  I try to access the API by giving header as  "Content-Type"  with Rest connector in Qlik sense. It is giving me an error saying

"Get doesn't support "Content-Type" in headers."

Please let me know to pass header Content-Type -- application/json in Qlik Sense while trying to access the API's.

Thanks,

Murali

1 Solution

Accepted Solutions
ErikWetterberg

Perhaps what you want is the Accept header? Somthing like:

Accept: application/json

to tell the server that you want json.

Hope this helps

Erik Wetterberg

View solution in original post

4 Replies
Øystein_Kolsrud
Employee
Employee

I don't think you're supposed to use the content-type header for GET methods. GET method calls doesn't have any contents, so it doesn't really make sense there. You'll probably get a content-type header in your response though.

ErikWetterberg

Perhaps what you want is the Accept header? Somthing like:

Accept: application/json

to tell the server that you want json.

Hope this helps

Erik Wetterberg

khan_imran
Creator II
Creator II

Where to write that code?

Alastair_Ometis
Partner - Contributor III
Partner - Contributor III

Hi Erik,

 

I have an odd situation that requires the same.

our data provider has an endpoint that accepts both a post and a get request (for different purposes)

I believe that behind the scenes (at my data source provider) a shortcut has been taken which results in a 415 error when i make a get request without the Content-Type header  despite it being superfluous (as there is no content being sent).

 

I have checked the HTTP standard documentation here https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5 which seems to back up my statement.

 

This is all fine but it leaves me having to tell the data source provider that their api is poorly implemented and that they need to change it.

 

Are there any workarounds you can think of in this case?