Has anyone implemented it successfully?
You have to pass the parameters within a body parameter.
body = {“key1”:"value1","key2":”value2”, etc.}
Kyle
@Kyle - Thanks for the quick response. could you please share an example. Here's how I am passing, but it fails:
http://<hostname>/OTCS/cs/api/v2/nodes/351798/persmissions/custom
id: 351798permissions: {"see","see_contents"}right_id: 351911
And ofcourse OTCSticket.
I get "One or more parameters are invalid". Could you please let me know the exact syntax you are using?
Thanks
In my previous post, please ignore the spelling mistakes.... e.g. in url its 'permissions' I am using correct URI. I would appreciate if you can share screenshot or working example. Thanks!!!
Hi Jatinder,
It's pretty picky, and you have to be careful with how you write up your permissions.
But here is how you can set see and see_contents in POSTMAN (I'm sure there are a few other ways to pass it, too):
POST: /cs.exe/api/v2/nodes/54215/permissions/customHeader:otcsticket: "Your_ticket"
Content-Type: application/x-www-form-urlencoded
Body:
URL Encode your payload, and pass that as RAW in PostMan.
EX:
body={"Permissions":["see","see_contents"],"addEmptyAttribute":true,"right_id":65406}
Adds a user by the ID of 65406 to a node of 54215, with "see" and "see_contents" permissions.
URL Encoded:
body%3D%7B%22Permissions%22%3A%5B%22see%22%2C%22see_contents%22%5D%2C%22addEmptyAttribute%22%3Atrue%2C%22right_id%22%3A65406%7D
POST that, and then you should get a 200 back with an empty results {}, if you get anything else, these perms already exist, or the format was incorrect.
You should now see that user on the node, with see and see_contents.
My general advice for people trying to use REST to achieve something: if the SmartUI has an equivalent action, run Fiddler/WireShark and then just perform that action in SmartUI.
SmartUI will generate the appropriate GET/POST/PUT/etc. for that action, and you can copy out its format if the API docs aren't clear.
Thanks,
Nizar
Nizar - Thanks for the quick response. But this gives error : "Missing required parameter 'Permissions'".
Is it possible to call me at 5104210538? If things are working for you.It will be much easier.
Please contact support so that they can call you, directly.
However, for your benefit, please find attached my POSTMAN JSON export, save it as a Whatever.postman_collection.json, and import it into the program.
Change the appropriate bits.{ "info": { "_postman_id": "d12dda23-4133-485a-b8a5-85a8b557b063", "name": "Test", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "X.X.X.X/CS_MAIN3/cs.exe/api/v2/nodes/54215/permissions/custom", "request": { "method": "POST", "header": [ { "key": "otcsticket", "value": "boaK6raSmRSPhsoNugNjkw5ymEFZINMd68AaRcpXUhaRkWtCf0QSD1f8LSZ+TL7yKuxIbFMg2IRIUP5jANQ0sDWul6Uuf/4J", "type": "text" }, { "key": "Content-Type", "name": "Content-Type", "value": "application/x-www-form-urlencoded", "type": "text" } ], "body": { "mode": "raw", "raw": "body%3D%7B%22Permissions%22%3A%5B%22see%22%2C%22see_contents%22%5D%2C%22addEmptyAttribute%22%3Atrue%2C%22right_id%22%3A65406%7D" }, "url": { "raw": "X.X.X.X/CS_MAIN3/cs.exe/api/v2/nodes/54215/permissions/custom", "host": [ "X", "X", "X", "X" ], "path": [ "CS_MAIN3", "cs.exe", "api", "v2", "nodes", "54215", "permissions", "custom" ] } }, "response": [] } ]}
That works. Thank you, Nijar.
Could you please help me understand what "addEmptyAttribute":true this does?
Hi there
the problem here is that the Permissions key refers to an array.
one way (not sure if the only one) to give values to an array in from-data using postman is the following :
... Permissions --> value 1 Permissions --> value 2 etc ...
hope this helps. Cheers