Question about the API endpoint /api/node/locations
I'm reading through the documentation and trying to use the API endpoint /api/node/locations (PUT).
Could you give me example of the parameter locations?
In addition, I've noticed that the endpoint returns success even if you pass wrong parameters, for example:
The parameter has the same behaviour when submitting a string.
Thanks in advance!
The API PUT: /api/node/locations allows you to set the locations of a node. I know you are also using the API POST: /api/node/locations which allows you to alter the locations by adding or removing some.
So using the PUT method, you have to pass in an array all the locations you want to be set on your document.
For exemple if the current location of your document are :
And you want to remove "/Sites/_Groups/_Space1/Folder2" then add "/Sites/_Groups/_Space1/Folder3" (basically a move operation), you can use the PUT method, passing those locations :
Please tell me if that helps !
Thanks for the detailed info! I knew how the API operates but I raised the ticket because I strugged to get the API to work regardless of the parameter I submit. I'm having trouble with both the PUT and POST methods:
Post: I keep getting error 500 no matter what I submit. Example request:
PUT: It returns a success response no matter what value I give to the locations parameter (incorrect values like integers and broken strings included), but it doesn't really add another location to the file.
Could you confirm that it works on our side? I had a similar issue on so it might be related to the type of space we're using?
@k-georgiev Oh okay I think I understand, for PUT and POST methods usually, parameters have to be passed in the request's body and not in the URL parameters.
Here is a working exemple I have just tested on my development platform :
Please also make sure you have an "Content-Type: application/json" in the headers of your request.
Thank you in advance for your feedback !
@jlemangarin You're right about the body. I use parameters since using body to pass the data doesn't work on my Postman for some reason (and parameters does the job ). I tested it through our system though and it worked just dandy.
Sorry for the blonde question there, and thanks for all your help!