You can include control and functional parameters in the HTTP message body of an Oracle Commerce Platform REST Web Services request. The following HTTP request includes two functional parameters and a control parameter in its message body. The content in the message body is specified by the -d
flag in this cURL command.
curl -L -v -b customer_cookies.txt -H "Content-Type: application/json" -d "{ "login" : "JohnDoe@example.com" , "password" : "password123" }" "http://localhost:8280/rest/model/atg/userprofiling/ProfileActor/ login?atg-rest-user-input=MyMessageId"
The Oracle Commerce Platform REST Web Services server can interpret message body parameters in one of the following three markup formats. Make sure you set the correct Content-Type
value for the markup that you use.
XML
JSON
URL query string in Legacy REST
Note: The Legacy REST Web Services server will only accept parameters in the message body of a POST or PUT HTTP request. If you need to use the GET or DELETE methods, you need to include data with your request, and you cannot include URL parameters, use the
atg-rest-view
andatg-rest-http-method
control parameters. See Handling POST Requests as Other Methods.
Setting the Content-Type Value in REST Services
Set the Content-Type
value when you send an HTTP message with parameters in its message body. The Oracle Commerce Platform REST Web Services server uses this value to determine how to interpret the parameters. If you do not include the Content-Type
or include a value that does not match the markup of your parameters, the server will ignore the message body.
Use one of the following Content-Type
values to specify the markup of the parameters in a message body.
Content-Type: application/xml
Content-Type: application/json
Content-Type: application/x-www-form-urlencoded
The following REST MVC example shows an HTTP request that sets its Content-Type
to application/xml
.
curl -L -v -b customer_cookies.txt -H "Content-Type: application/xml" -d "{ "login" : "JohnDoe@example.com" , "password" : "password123" }" "http://localhost:8280/rest/model/atg/userprofiling/ProfileActor/ login?atg-rest-user-input=MyMessageId"
Using Array Types
To specify an array type in the atg-rest-class-descriptor
control parameter, use the standard Java notation for arrays.
Array Type | Java Notation |
---|---|
|
|
|
|
|
|
Two-dimensional array of |
|