0

I am building azure pipeline task which is calling an endpoint. However I keep getting error "unsupportedmediatype 415". here is my code

   "dataSources": [
    {
      "name": "ProjectsEP",     

       "endpointUrl": "{{endpoint.url}}/api/project/projects",
       "requestVerb": "Post",
       "resultSelector": "jsonpath:",
       "requestContent":"",
       "headers": [
       {
          "name": "Content-Type",
          "value": "application/json"
        }
     ] 
 }

"dataSourceBindings": [
  {
   "target": "project",
   "endpointId": "$(FabrikamService)",
   "dataSourceName": "ProjectsEP",
    "requestVerb": "Post"
  }]

I need to change the content-type to "application/json".

The same request works in postman same request in Postman

What am I missing here?

Rohit
  • 10,056
  • 7
  • 50
  • 82

1 Answers1

0

You could try the following format to set the headers and check if it could work:

"headers": "{\n\"Content-Type\":\"application/json\", \n\"Authorization\": \"Bearer  $(system.accesstoken)\"\n}"

Here is an example, you could refer to it.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28