Status: Open
Status: Answered
Status: Closed
Status: Duplicate

Does REST API support for multilingual

0
Posted Sep 26 by Akshay Bedarkar.

Does REST API support requests and response for different languages supported by Content Server 10.5
Ex. multi-lingual text search and creation of folders.
In particular we are looking such functionalities to be implemented for Portuguese, French & Spanish.
Please let me know how this can be achieved and if there any limitation on this ?

6 Answers

0
BEST ANSWER: As chosen by the author.

REST API has support for multilingual metadata during creation and update, such as multilingual description and multilingual name.

CREATE a folder:

POST /nodes
body={"type":0, "parent_id":2000, "name":"New EN name", "name_multilingual": { "de":"New DE name", "en": "New EN name" }}


UPDATE a folder:

PUT /nodes/{id}
body={"name":"New EN name", "name_multilingual": { "de":"New DE name", "en": "New EN name" }}


0
BEST ANSWER: As chosen by the author.

… and they are returned when getting the node information too:

GET folder info:

GET /nodes/{id}

{
  "data": {
    "name_multilingual": {
       “de”: “New DE name”,
       “en”: “New EN name”
    },
    ...
}

Single language versions of the multilingual properties (name and description) are in the language chosen in the personal settings of the user authenticating the REST API request. Also, if you use filtering parameters for the children listing request (/nodes/:id/nodes?where_name=...) the text will be looked for in the localized node names; localized to the language of the authenticated user, if available.


0
BEST ANSWER: As chosen by the author.

Coming to this post late, but how do you POST or PUT the JSON object implied in the above response to the REST API? If you did something like
$.ajax({

     url: RESTURL,   
     method: 'PUT',  
     data: someJSONObj,  
     .....  

});
You will get BAD REQUEST from the server. I know from previous discussions in the KC that in the cs.exe CGI executable binary that it cannot manage JSON data so I assume you need to do something like JSON.Stringify(someJSONObj);
I just verified that you get past the BAD REQUEST using JSON.stringify() but I don't seem to be getting my ML values into the LLNode.NodeUpdate() call. In the REST API execute method, it doesn't parse properly. How have others managed to get the data as JSON into something that Content Server can actually parse?
-Hugh


0
BEST ANSWER: As chosen by the author.

I just tried with below request in Postman and it worked within my only language environment.

It seems we have to pass this json object in query string (seems odd :( ) with parameter name of body.

http://server/cs.exe/api/v1/nodes/2329323?suppress_response_codes&body={"name":"New Name","name_multilingual":{"en_US":"EN Name"}}

Good luck.

Regards,
Khurram


0
BEST ANSWER: As chosen by the author.

Cheers Khurram,
Did you do that as a GET, POST, or PUT request? I tried something similar, that is, I created a PUT request where the URL portion was the http://server/cs.exe/api/v1/nodes/:id and I added to the body a parameter called body with the stringified JSON data. The only thing I didn't try was to put the new name and description into body (I treated them as separate parameters). I assume when you did the above, you had to URIEncode the JSON string above?
-Hugh


0
BEST ANSWER: As chosen by the author.

with PUT

enter image description here

I did not encode the input rather just plain text in Postman.


 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.

Statistics

Related categories

Related tags

Your answer

To leave an answer, please sign in.