<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Web API: Headers in Web-Activity vs. Headers in Copy data-Activity in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3319444#M331</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Seems you are putting bearer token in&amp;nbsp;additionalHeaders of&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/connector-http?tabs=data-factory#http-as-source" target="_self"&gt;Http connector&lt;/A&gt;&amp;nbsp;, try additionalHeaders value in a whole string like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;@concat('Authorization: Bearer ',@variables('v_token'))&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/connector-rest?tabs=data-factory" target="_self"&gt;REST connector&lt;/A&gt;, payload is like below, where you can add fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2023 01:55:15 GMT</pubDate>
    <dc:creator>GraceGu</dc:creator>
    <dc:date>2023-07-07T01:55:15Z</dc:date>
    <item>
      <title>Web API: Headers in Web-Activity vs. Headers in Copy data-Activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3316414#M322</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to query an API with Data Pipelines.&lt;/P&gt;&lt;P&gt;The API expects to first generate a Token and then use the Token as Authorization to make the desired query.&lt;/P&gt;&lt;P&gt;First part works fine - I get a valid Token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As next step I first tried using the Copy data Activity. I set up the connection (is working), set connection type to http and POST method, file format json. This should all be fine. The problem seems to be the "Additional headers" part and the "Request body" part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the Code of the &lt;STRONG&gt;Copy data Activity&lt;/STRONG&gt; I get this. (See part starting at "additionalHeaders" - this is the problem):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"typeProperties": {
        "source": {
            "type": "JsonSource",
            "storeSettings": {
                "type": "HttpReadSettings",
                "requestMethod": "POST",
                "additionalHeaders": {
                    "value": "\"Authorization\": {\n                \"value\": \"@concat('Bearer ', variables('v_token'))\",\n                \"type\": \"Expression\"\n            },\n            \"Content-Type\": \"application/json\",\n            \"Accept\": \"application/json\"",
                    "type": "Expression"
                },
                "requestBody": "{\n  \"sql\": \"SELECT * FROM table WHERE Date='2023-07-03'\"\n}",
                "requestTimeout": ""
            },
            "formatSettings": {
                "type": "JsonReadSettings"
            },
            "datasetSettings": {
                "annotations": [],
                "type": "Json",
                "typeProperties": {
                    "location": {
                        "type": "HttpServerLocation"
                    }
                },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The Data Pipeline seems to be adding Backslashes&amp;nbsp;&lt;SPAN&gt;\&amp;nbsp;&lt;/SPAN&gt;I can't seem to get rid of!! This problem seems to exist in ADF as well:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/72095530/trouble-accessing-json-from-web-api-call-in-adf-and-inserting-in-sql-table/72128255#72128255" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/72095530/trouble-accessing-json-from-web-api-call-in-adf-and-inserting-in-sql-table/72128255#72128255&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If use the&lt;STRONG&gt; Web-Activity&lt;/STRONG&gt; I can use the dedicated fields for Headers - this gives me this Code which is working fine and the API replies accordingly:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    "name": "Web2",
    "type": "WebActivity",
    "dependsOn": [
        {
            "activity": "var for token",
            "dependencyConditions": [
                "Succeeded"
            ]
        }
    ],
    "policy": {
        "timeout": "0.12:00:00",
        "retry": 0,
        "retryIntervalInSeconds": 30,
        "secureOutput": false,
        "secureInput": false
    },
    "typeProperties": {
        "method": "POST",
        "headers": {
            "Authorization": {
                "value": "@concat('Bearer ', variables('v_token'))",
                "type": "Expression"
            },
            "Content-Type": "application/json",
            "Accept": "application/json"
        },
        "body": {
            "sql": "SELECT * FROM table WHERE Date='2023-07-03'"
        }
    },
    "externalReferences": {
        "connection": "ed851474-77e8-41e5-917d-33171377856b"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However those dedicated Header Fields exist in the Web-Activity but not in the Copy-data activity!&lt;/P&gt;&lt;P&gt;So my question is: how do I have to enter the text in the Copy data activity to get the request formatted&amp;nbsp;correctly for the API?&lt;/P&gt;&lt;P&gt;I could use the Web activity however I not sure how I would get the data to the Datawarehouse as the Web activity has not Destination section!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is highly appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 13:44:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3316414#M322</guid>
      <dc:creator>chris__1</dc:creator>
      <dc:date>2023-07-05T13:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Web API: Headers in Web-Activity vs. Headers in Copy data-Activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3319444#M331</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Seems you are putting bearer token in&amp;nbsp;additionalHeaders of&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/connector-http?tabs=data-factory#http-as-source" target="_self"&gt;Http connector&lt;/A&gt;&amp;nbsp;, try additionalHeaders value in a whole string like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;@concat('Authorization: Bearer ',@variables('v_token'))&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/connector-rest?tabs=data-factory" target="_self"&gt;REST connector&lt;/A&gt;, payload is like below, where you can add fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 01:55:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3319444#M331</guid>
      <dc:creator>GraceGu</dc:creator>
      <dc:date>2023-07-07T01:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Web API: Headers in Web-Activity vs. Headers in Copy data-Activity</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3320187#M333</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475409" data-lia-user-login="GraceGu" class="lia-mention lia-mention-user"&gt;GraceGu&lt;/a&gt;&amp;nbsp;! Worked exactly as discribed when using the REST connector:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 09:51:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Web-API-Headers-in-Web-Activity-vs-Headers-in-Copy-data-Activity/m-p/3320187#M333</guid>
      <dc:creator>chris__1</dc:creator>
      <dc:date>2023-07-07T09:51:54Z</dc:date>
    </item>
  </channel>
</rss>

