question

Prasad-2996 avatar image
0 Votes"
Prasad-2996 asked ·

ADF - Web/Rest API request content-Type issue

Currently working on GET request in Azure Data Factory pipeline. The request works perfectly fine in Postman and CURL, but when tried in ADF it is not successful

Passing the Bearer token with Oauth
76979-image.png

When tried the same in ADF, getting the following error

Web activity
77032-image.png

Error: Details { "errors" : [ { "message" : "Content type '' not supported", "type" : "HttpMediaTypeNotSupportedError" } ] }

I have tried with Rest API and HTTP connector as well, getting similar error. Please advise if there any limitation on Content-Type and/or how we can address this issue.

Added:
I have tried different options as well but no success
76820-image.png


azure-data-factory
image.png (46.4 KiB)
image.png (17.6 KiB)
image.png (5.7 KiB)
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@prasad-2996 Thanks for using Microsoft Q&A !!

Can you please try adding all the headers (like accept-encoding etc.) as you are passing in Postman. Also, please send an email to azcommunity[at]microsoft[dot]com with your pipeline/activity runid, subscription id with this Q&A thread link and subject as "Attn: Saurabh' and I will look into this.

0 Votes 0 ·
Prasad-2996 avatar image Prasad-2996 SaurabhSharma-msft ·

Thanks Saurabh, I have sent the requested details via email.

I have tried the same settings as postman as well, but still getting the same content-Type error.

0 Votes 0 ·

Could you please try with POST instead of GET with content-Type application/x-www-form-urlencoded. I had same issue which got resolved with these changes

77485-image-2021-03-13-182216.png


0 Votes 0 ·

Thank you for taking the time to reply.
The login.microsoft..... url works file for me. We have another API we are having issues with, that request fails with POST request.

0 Votes 0 ·
Prasad-2996 avatar image
1 Vote"
Prasad-2996 answered ·

Thank you @SaurabhSharma-msft
Symptom:
Web Activity and REST connector have error in GET request.
Error: Details { 'errors' : [ { 'message' : 'Content type '' not supported', 'type' : 'HttpMediaTypeNotSupportedError' } ] }


Cause:
ADF drops the Content-type header from a GET request if ‘request body’ is not specified, so per REST semantics, it should not have Content-type header enforced in a REST API because Content-Type entity-header field indicates the media type of the entity-body sent to the recipient


Resolution:
Change the receiving API setting content-type as optional



·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ma01 avatar image
0 Votes"
ma01 answered ·

If auth works , then the next web activity for actual API (which uses the Bearer token) should be something like this. Hope it resolves your issue.

@concat('Bearer ',activity('AuthToken').output.access_token) [Authorization expression]


77500-image.png





image.png (30.0 KiB)
· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

As you can see in my earlier post this is the configuration I have been trying, but having issues (mentioned the error message above)

0 Votes 0 ·