- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.
01-17-2020 08:07 AM
I follow the example from body parameters. When I split it up, one gets the following structure:
[
{
"op": "replace",
"path": "/address",
"value": "10.10.27.254"
},
{
"op": "replace",
"path": "/secretManagement/automaticManagementEnabled",
"value": "false"
}
]My body looks:
[
{
"op": "Replace",
"path": "/address",
"value": "10.10.10.10"
}
]The error message I receive is:
"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
'Newtonsoft.Json.Linq.JObject'."
The line to create the body variable is:
$body = ConvertTo-Json -Depth 2 -InputObject @(
[PSCustomObject] @{
op = $Operation;
path = "/$Path";
value = $Value;
}
)Where could be the error? Should the body have a different JSON structure?
02-27-2020 02:39 AM
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 unofficial CyberArk REST API "PATCH" is the method to use.
Below is the working API call (The session variable carries the Authentication and Content-Type keys).
Invoke-RestMethod -Method Patch -Uri $url -Body $body -WebSession $Session
01-19-2020 12:05 AM
Hi @Alexander Piepenhagen
Not sure about this, but try lowercase "Replace" -> meaning "replace"
one other thing, related to the error you mentioned.
I think you should split the line into two steps:
creating this (similar to what you posted):
PS > $a = @( @{ op="replace";path="/address";value="10.10.10.10"})
PS > $a | ConvertTo-Json
{
"path": "/address",
"op": "replace",
"value": "10.10.10.10"
}
is creating a JSON object, not an Array like in the example
Try using:
$array = @()
$body = "" | select op, path, value
$body.op = "replace"
$body.path = "/address"
$body.value = "10.10.10.10"
$array += $body
$array | ConvertTo-JSON
Hope this helps,
Assaf
02-27-2020 02:39 AM
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 unofficial CyberArk REST API "PATCH" is the method to use.
Below is the working API call (The session variable carries the Authentication and Content-Type keys).
Invoke-RestMethod -Method Patch -Uri $url -Body $body -WebSession $Session
02-27-2020 03:10 AM
Great to hear that this resolved the issue 🙂
by the way, in the official documentation this is also written see:
https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/SDK/UpdateAccount%20v10.htm#Resourceinformation
02-27-2020 03:43 AM
Ah, now I see it too. Because of the bold font I disregarded it as a header. I only saw the 'Content type' row 😄
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

