<?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: Update Account does not accept the JSON body in PAM Self-Hosted Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383684#M66033</link>
    <description>&lt;P&gt;The error was actually not in the body but in the Method I used. As the documentation did not mention the method I assumed "POST" should be used but looking at the &lt;A alt="https://documenter.getpostman.com/view/998920/RzZ9Gz1U?bs=true&amp;amp;version=latest#this-is-unofficial-documentation" href="https://documenter.getpostman.com/view/998920/RzZ9Gz1U?bs=true&amp;amp;version=latest#this-is-unofficial-documentation" target="_blank"&gt;unofficial CyberArk REST API&lt;/A&gt; "PATCH" is the method to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the working API call (The session variable carries the Authentication and Content-Type keys).&lt;/P&gt;&lt;CODE&gt;Invoke-RestMethod -Method Patch -Uri $url -Body $body -WebSession $Session&lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2020 10:39:37 GMT</pubDate>
    <dc:creator>CyberArkAlumni</dc:creator>
    <dc:date>2020-02-27T10:39:37Z</dc:date>
    <item>
      <title>Update Account does not accept the JSON body</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383682#M66031</link>
      <description>&lt;P&gt;I follow the example from body parameters. When I split it up, one gets the following structure:&lt;/P&gt;&lt;CODE&gt;[
    {
        "op": "replace", 
        "path": "/address", 
         "value": "10.10.27.254"
     },
    { 
          "op": "replace", 
          "path": "/secretManagement/automaticManagementEnabled", 
          "value": "false"
    }
]&lt;/CODE&gt;&lt;P&gt;My body looks:&lt;/P&gt;&lt;CODE&gt;[
    {
        "op":  "Replace", 
        "path":  "/address",
        "value":  "10.10.10.10"
    }
]&lt;/CODE&gt;&lt;P&gt;The error message I receive is:&lt;/P&gt;&lt;P&gt;"The parameters dictionary contains an invalid entry for parameter 'actionParameters' for method 'System.Net.Http.HttpResponseMessage [...] The dictionary contains a value of type 'Newtonsoft.Json.Linq.JArray', but the parameter requires a value of type&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Newtonsoft.Json.Linq.JObject'."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The line to create the body variable is:&lt;/P&gt;&lt;CODE&gt;$body = ConvertTo-Json -Depth 2 -InputObject @(
                    [PSCustomObject] @{
                            op = $Operation;
                            path = "/$Path";
                            value = $Value;
                    }
                )&lt;/CODE&gt;&lt;P&gt;Where could be the error? Should the body have a different JSON structure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:07:33 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383682#M66031</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2020-01-17T16:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update Account does not accept the JSON body</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383683#M66032</link>
      <description>&lt;P&gt;Hi @Alexander Piepenhagen​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure about this, but try lowercase "Replace" -&amp;gt; meaning "replace"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;one other thing, related to the error you mentioned.&lt;/P&gt;&lt;P&gt;I think you should split the line into two steps:&lt;/P&gt;&lt;P&gt;creating this (similar to what you posted):&lt;/P&gt;&lt;P&gt;PS &amp;gt; $a = @( @{ op="replace";path="/address";value="10.10.10.10"})&lt;/P&gt;&lt;P&gt;PS &amp;gt; $a | ConvertTo-Json&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"path":&amp;nbsp;"/address",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"op":&amp;nbsp;"replace",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"value":&amp;nbsp;"10.10.10.10"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is creating a JSON object, not an Array like in the example&lt;/P&gt;&lt;P&gt;Try using:&lt;/P&gt;&lt;P&gt;$array = @()&lt;/P&gt;&lt;P&gt;$body = "" | select op, path, value&lt;/P&gt;&lt;P&gt;$body.op = "replace"&lt;/P&gt;&lt;P&gt;$body.path = "/address"&lt;/P&gt;&lt;P&gt;$body.value = "10.10.10.10"&lt;/P&gt;&lt;P&gt;$array += $body&lt;/P&gt;&lt;P&gt;$array | ConvertTo-JSON&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Assaf&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 08:05:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383683#M66032</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2020-01-19T08:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Update Account does not accept the JSON body</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383684#M66033</link>
      <description>&lt;P&gt;The error was actually not in the body but in the Method I used. As the documentation did not mention the method I assumed "POST" should be used but looking at the &lt;A alt="https://documenter.getpostman.com/view/998920/RzZ9Gz1U?bs=true&amp;amp;version=latest#this-is-unofficial-documentation" href="https://documenter.getpostman.com/view/998920/RzZ9Gz1U?bs=true&amp;amp;version=latest#this-is-unofficial-documentation" target="_blank"&gt;unofficial CyberArk REST API&lt;/A&gt; "PATCH" is the method to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the working API call (The session variable carries the Authentication and Content-Type keys).&lt;/P&gt;&lt;CODE&gt;Invoke-RestMethod -Method Patch -Uri $url -Body $body -WebSession $Session&lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:39:37 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383684#M66033</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2020-02-27T10:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update Account does not accept the JSON body</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383685#M66034</link>
      <description>&lt;P&gt;Great to hear that this resolved the issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;by the way, in the official documentation this is also written see:&lt;/P&gt;&lt;P&gt;https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/SDK/UpdateAccount%20v10.htm#Resourceinformation&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 11:10:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383685#M66034</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2020-02-27T11:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Update Account does not accept the JSON body</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383686#M66035</link>
      <description>&lt;P&gt;Ah, now I see it too. Because of the bold font I disregarded it as a header. I only saw the 'Content type' row &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 11:43:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-discussions/update-account-does-not-accept-the-json-body/m-p/1383686#M66035</guid>
      <dc:creator>CyberArkAlumni</dc:creator>
      <dc:date>2020-02-27T11:43:54Z</dc:date>
    </item>
  </channel>
</rss>

