Syntax error for user bulk update?

Why does this syntax work (found this on a previous thread)
echo '[{"id": "6e1f6fc4-a6b3-44de-9ac7-a1234532e7f", "acdAutoAnswer": true}]' | gc.exe users bulk update

But not this? To me, its identical.
@{
"id"="6e1f6fc4-a6b3-44de-9ac7-a1234532e7f";
"acdAutoAnswer"= 'true';
} | ConvertTo-Json | gc.exe users bulk update

Error:
"message": "The request could not be understood by the server due to malformed syntax.",
"code": "bad.request",
"status": 400,
"contextId": "0e5272d9-47f7-4a55-9fc8-f8799550cec6",
"details": [],
"errors": []

Hello,

The bulk update command expects a JSON array as input -> the square brackets
[{"id": "6e1f6fc4-a6b3-44de-9ac7-a1234532e7f", "acdAutoAnswer": true}, {"id": "5d1f6fc4-1234-44de-9ac7-a1234532e7f", "acdAutoAnswer": true}, ...]
or with 1 element inside:
[{"id": "6e1f6fc4-a6b3-44de-9ac7-a1234532e7f", "acdAutoAnswer": true}]

Your command sends a single JSON object - not an array of JSON objects.

Regards,

Thanks for the clarification!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.