xtern commented on a change in pull request #8245: URL: https://github.com/apache/ignite/pull/8245#discussion_r490096591
########## File path: docs/_docs/restapi.adoc ########## @@ -240,6 +243,69 @@ Similarly, the `get` command with `keyType=int` and `valueType=date` would be: http://[host]:[port]/ignite?cmd=get&key=1&cacheName=myCache&keyType=int&valueType=date ---- +=== Custom user defined types + +For custom objects, the JSON format is used. For example, we can work with the following object using the REST API: +[source, javascript] + { + "uid": "7e51118b-eb15-4373-b57f-4984cb9cd7ac", + "name": "John Doe", + "organization": 5678901, + "married": false, + "salary": 156.1 + } + +The following request puts this object into the cache `testCache` as a value with a type name `Person` and a key `1`. + + http://[host]:[port]/ignite?cacheName=testCache&cmd=put&keyType=int&key=1&valueType=Person&val=%7B%0A+++++%22uid%22%3A+%227e51118b-eb15-4373-b57f-4984cb9cd7ac%22%2C%0A+++++%22name%22%3A+%22John+Doe%22%2C%0A+++++%22organization%22%3A+5678901%2C%0A+++++%22married%22%3A+false%2C%0A+++++%22salary%22%3A+156.1%0A++%7D& + +On the server side, the JSON value from this request will be converted to link:/docs/data-modeling/data-modeling#binary-object-format[binary object]. Field types are resolved in the following order: + +* If the type name is a `Java class` available on the server, the class field types with corresponding names will be used for JSON object field types resolving. Review comment: fixed, thanks ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
