<?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: Post JSON without PowerBI Reformatting it in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2336802#M34389</link>
    <description>&lt;P&gt;Many thanks for this, I think I tried so many things over many days I kept this error in, I installed fiddler and got a bit further, the posted JSON appears to be valid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's happening is becuase I have:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Prisma = [
    Authentication = [ 
        UsernamePassword = [
            UsernameLabel = "API User",
            PasswordLabel = "API Password"
        ]
    ],
    Label = "Data Connector"
];&lt;/LI-CODE&gt;&lt;P&gt;Power Query is adding a header:&lt;/P&gt;&lt;P&gt;Authorization: Basic XXXX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The remote webserver is replying:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;message=request has different values in X-Redlock-Auth and Authorization, unclear which to use.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't understand why I'm sending over an API key and setting the Authorization header to basic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to remove Authorisation from the header or change my inputs so I can ask the end user for a username / password (this is how I get the login key) but don't set the header?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API Doc:&amp;nbsp;&lt;A href="https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin/get-started-with-prisma-cloud/access-the-prisma-cloud-api.html" target="_blank" rel="noopener"&gt;https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin/get-started-with-prisma-cloud/access-the-prisma-cloud-api.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 11:27:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-02-14T11:27:26Z</dc:date>
    <item>
      <title>Post JSON without PowerBI Reformatting it</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2334099#M34352</link>
      <description>&lt;P&gt;I need to send this post data to an API endpoint:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "limit": 5,
    "detailed": "true",
    "policy.complianceStandard": "Scope 2021",
    "timeRange": {
        "type": "to_now",
        "value": "EPOCH"
    },
    "filters": [
        {
            "name": "alert.status",
            "operator": "=",
            "value": "open"
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried formatting this as an array as it looked nicer in my code, but M doesn't seem to like my filters object, the only way I seem to be able to get a single element array with an object in it was to give it a key of 0 but then the remote server gave me a 400 bad request, so I went for the manual approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        alertPayload = "{
            ""limit"": 10,
            ""detailed"": ""true"",
            ""policy.complianceStandard"": ""Scope 2021"",
            ""timeRange"": {
                ""type"": ""to_now"",
                ""value"":""EPOCH""
            },
            ""filters"": [
                {
                    ""name"": ""alert.status"",
                    ""operator"": ""="",
                    ""value"": ""open"" 
                }
            ]
        }",

        
        responseAlert = Web.Contents("https://api.io/v2/alert", [
            Headers = [
                #"Content-Type" = "application/json",
                #"x-redlock-auth" = token
            ],
            Content = Text.FromBinary(alertPayload)
        ]),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I give alertPayload directly to content it complains, but if I surround it with Text.FromBinary or JSON.FromValue then the remote webserver gives me a 400 bad request indicating M has changed something, is there a way to say post this text to the web server and tell M don't change it or that it's pre-formatted?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 18:03:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2334099#M34352</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-11T18:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Post JSON without PowerBI Reformatting it</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2335090#M34363</link>
      <description>&lt;P&gt;You are supposed to use Text.ToBinary, not Text.FromBinary.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Feb 2022 03:38:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2335090#M34363</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-02-13T03:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Post JSON without PowerBI Reformatting it</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2336802#M34389</link>
      <description>&lt;P&gt;Many thanks for this, I think I tried so many things over many days I kept this error in, I installed fiddler and got a bit further, the posted JSON appears to be valid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's happening is becuase I have:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Prisma = [
    Authentication = [ 
        UsernamePassword = [
            UsernameLabel = "API User",
            PasswordLabel = "API Password"
        ]
    ],
    Label = "Data Connector"
];&lt;/LI-CODE&gt;&lt;P&gt;Power Query is adding a header:&lt;/P&gt;&lt;P&gt;Authorization: Basic XXXX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The remote webserver is replying:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;message=request has different values in X-Redlock-Auth and Authorization, unclear which to use.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't understand why I'm sending over an API key and setting the Authorization header to basic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to remove Authorisation from the header or change my inputs so I can ask the end user for a username / password (this is how I get the login key) but don't set the header?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API Doc:&amp;nbsp;&lt;A href="https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin/get-started-with-prisma-cloud/access-the-prisma-cloud-api.html" target="_blank" rel="noopener"&gt;https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-admin/get-started-with-prisma-cloud/access-the-prisma-cloud-api.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 11:27:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2336802#M34389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-14T11:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Post JSON without PowerBI Reformatting it</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2336819#M34390</link>
      <description>&lt;P&gt;Just an update, I got it to work (thanks for the advice), sharing for completeness&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed:&lt;/P&gt;&lt;P&gt;ManualCredentials = true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the request.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        responseAlert = Web.Contents("https://api.io/v2/alert", [
            Headers = [
                #"Content-Type" = "application/json",
                #"x-redlock-auth" = token
            ],
            Content = Text.ToBinary(alertPayload),
            ManualCredentials = true
        ]),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 11:40:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-JSON-without-PowerBI-Reformatting-it/m-p/2336819#M34390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-14T11:40:45Z</dc:date>
    </item>
  </channel>
</rss>

