This section provides information about the way the Legacy REST Web Services server expects to receive parameter values.

Multiple Values in Input

The Legacy REST Web Services server will accept map and collection input when you set the values of properties that accept multiple values.

Unless you are setting the value of a repository item, you must specify the Java classes used for the container and the contents.

The following example shows a Legacy REST Web Services request that appends a value to a non-repository component property. It includes all existing values in the property along with the new value. To remove a value, make a similar request that includes only the values that you wish to remain in the property.

curl -v -b cookies.txt -X POST \
-H "Content-Type: application/json" \
-d "{'atg-rest-param-class-types':{'container-class':'java.util.ArrayList',
'element-class':'java.lang.String'},
'arg1':['Existing String in the Collection','New String for the Collection']}" \
http://myserver:7003/rest/bean/atg/MyDog/tricks?atg-rest-json-input=true

Appending Values to Repository Item Properties

To append data to a repository item property that holds multiple values, set the new value as you would for a single value property.

The following example adds two repository item reference values to a repository item property that can hold multiple values. Any existing values in that property will remain there.

curl -v -b cookies.txt -X POST \
-H "Content-Type: application/xml" \
-d "<parameters><arg1>/atg/commerce/gifts/Giftlists/gift-list/gl40050,
/atg/commerce/gifts/Giftlists/gift-list/gl40052</arg1></parameters>" \
http://myserver:8080/rest/repository/atg/userprofiling/ProfileAdapterRepository/
user/130001/giftlists

Note: The Legacy REST Web Services server is configured to append values to repository item properties that accept multiple values by default. The appendMultiValuesByDefault configuration property controls this behavior for repository item properties. If you have reconfigured this setting, set the atg-rest-append-multi-values control parameter to true for each Legacy REST Web Services request that should append the new value.

Replacing Multiple Values in a Repository Item Property

To replace all the existing values in a repository item property that holds multiple values, include the atg-rest-append-multi-values control parameter with your Legacy REST Web Services request. Set the value of the control parameter to false.

Note: You can only use the rest-append-multi-values control parameter with repository item properties. It does not affect the way you can update non-repository properties.

The following example replaces all the values that are currently in a repository item property that holds multiple values. Only the repository item reference that is in the functional parameter will remain in the property.

curl -v -b cookies.txt -X POST \
-H "Content-Type: application/xml" \
-d "<parameters><arg1>/atg/commerce/gifts/Giftlists/gift-list/gl40049</arg1>
</parameters>" \
http://myserver:8080/rest/repository/atg/userprofiling/ProfileAdapterRepository/
user/130001/giftlists?atg-rest-append-multi-values=false

JSON Markup Input for Multiple Value Repository Item Properties

If you are setting multiple values in a repository item property, you can use standard JSON markup for the collection or map value. Include the atg-rest-json-input with your Legacy REST Web Service request and set its value to true.

You can include JSON markup for multiple values in any input format. The following example shows a Legacy REST Web Services request that includes a JSON collection in an XML message body parameter.

curl.exe -v -b cookies.txt -X POST \
-H "Content-Type: application/xml" \
-d "<parameters><arg1>[ "/atg/commerce/gifts/Giftlists/gift-list/gl40050",
"/atg/commerce/gifts/Giftlists/gift-list/gl40052" ]</arg1></parameters>" \
http://myserver:8080/rest/repository/atg/userprofiling/ProfileAdapterRepository/
user/130001/giftlists?atg-rest-json-input=true

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices