Format uids for API body
I have run into this in a couple of places, but the one I am working on now is this:
https://domain.teamdynamix.com/TDWebApi/api/people/bulk/changeactivestatus?isActive=false
The documentation says "Request Body (Validated as "uids")". How should that be formatted? I have tried dozens of combinations and can't figure it out. I continue to get "A positional parameter cannot be found that accepts argument <argument I used>"
Update: That error was due to punctuation... Here is the current error:
Exception Message: Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.IEnumerable`1[System.Guid]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Here is what I am sending:
{
"uids": [
"user 1 uid",
"user 2 uid"
] }
I am using PowerShell, but if I could see the format in JSON I'm sure I could translate it.
Non-bulk API calls work fine.
Answer (1)
Hello John,
The call body for this would just be an array of user UIDs, like so:
[ Uid1, Uid2, Uid3, etc]
Sincerely,
Mark Sayers
Sr Support Consultant, CS