To set a property that takes a Java object as its value, include the atg-rest-class-type control parameter along with the initial properties for the object in the positional parameter for the property value. The atg-rest-class-type control parameter specifies the Java class of the object. Use either JSON or XML to enclose the positional parameter.

The REST Web Services server will return a boolean value to indicate whether the object property has been set successfully. If it is set successfully, the returned value is true.

See more information about setting property values in Setting Component Properties and Setting Repository Item Properties.

Note: The REST Web Services interface can only create objects of classes that have a nullary constructor. At least one constructor for the class must have no arguments.

Here is an object property value encoded in JSON. The class for the object is atg.MyObjectValue. The following parameters set properties of the new object.

{"arg1":
{"atg-rest-class-type" : "atg.MyObjectValue",
"name" : "Berthoud",
"height" : "1"}
}

Here is the same object property value, encoded in XML.

<parameters>
<arg1>
<atg-rest-class-type>atg.MyObjectValue</atg-rest-class-type>
<name>Berthoud</name>
<height>1</height>
</arg1>
</parameters>

The following example shows a POST request to set an object property value for a Nucleus component.

$ curl -v -b cookies.txt -X POST -H "Content-Type: application/json" -d "{"arg1":{"atg-rest-class-type":"atg.MyObjectValue","name":"Berthoud","height":"1"}}" http://myserver:7003/rest/bean/atg/MyDog/objectvalue
* About to connect() to myserver port 7003 (#0)
*   Trying 12.34.567.890... connected
* Connected to myserver (12.34.567.890) port 7003 (#0)
> POST /rest/bean/atg/MyDog/objectvalue HTTP/1.1
> User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.5
> Host: myserver:7003
> Accept: */*
> Cookie: JSESSIONID=llf3PN8N0CfQ6h41Y278NfLjvCJZn6CR8ydhQRbg7GTQ7Nn5mW8p!1359398113; DYN_USER_CONFIRM=838bac4608584930cf177410e3b46448; DYN_USER_ID=110001
> Content-Type: application/json
> Content-Length: 69
>
< HTTP/1.1 200 OK
< Date: Wed, 29 Feb 2012 05:52:39 GMT
< Transfer-Encoding: chunked
< Content-Type: application/json; charset=UTF-8
< X-ATG-Version: version=QVRHUGxhdGZvcm0vMTAuMSxDb21tZXJjZVJlZmVyZW5jZVN0b3JlLzEwLjE=
< X-Powered-By: Servlet/2.5 JSP/2.1
<
* Connection #0 to host myserver left intact
* Closing connection #0
{"atgResponse": true}