webMethods, OneData, and Terracotta  10.2 | Managing Master Data with webMethods OneData | Developing for webMethods OneData | REST Web Services | GET and POST Services | HTTP Request Header Parameters for GET and POST
 
HTTP Request Header Parameters for GET and POST
The following table lists the essential header parameters for GET and POST requests in REST calls and the OneData response formats.
HTTP Method
OneData Operation
Accept Header
Content-type
OneData Response
GET
GET
application/json
Not applicable
Fetch data in JSON format
application/xml
Not applicable
Fetch data in XML format
No header (default)
Not applicable
Fetch data in XML format
POST
POST
Not applicable
application/json
Post data in JSON format
Not applicable
application/xml
Post data in XML format
Not applicable
No content-type (default)
Post data in XML format
POST
GET operation for filter conditions
application/json
application/x-www-form-urlencoded
Fetch data in JSON format
application/xml
application/x-www-form-urlencoded
Fetch data in XML format
No Accept header (default)
application/x-www-form-urlencoded
Fetch data in XML format
Response Examples
Example 1: GET operation response in XML format
The following is an example of OneData response to a GET request with the Accept header and content-type as application/xml.
<?xml version="1.0"?>
<COUNTRY>
<datarow>
<COUNTRY_ID>10</COUNTRY_ID>
<COUNTRY_NAME>SRILANKA</COUNTRY_NAME>
<STATE>
<datarow>
<STATE_ID>10</STATE_ID>
<STATE_NAME>COLOMBO</STATE_NAME>
<CONSTRAINT_COUNTRY_STATE>SRILANKA</CONSTRAINT_COUNTRY_STATE>
</datarow>
</STATE>
</datarow>
<datarow>
<COUNTRY_ID>1</COUNTRY_ID>
<COUNTRY_NAME>INDIA</COUNTRY_NAME>
<STATE>
<datarow>
<STATE_ID>1</STATE_ID>
<STATE_NAME>KARNATAKA</STATE_NAME>
<CONSTRAINT_COUNTRY_STATE>INDIA</CONSTRAINT_COUNTRY_STATE>
</datarow>
</STATE>
</datarow>
</COUNTRY>
Example 2: GET operation response in JSON format
The following is an example of OneData response to a GET request with the Accept header and content-type as application/json.
{
"COUNTRY": [
{
"COUNTRY_ID": "10",
"COUNTRY_NAME": "SRILANKA",
"STATE": [
{
"STATE_ID": "10",
"STATE_NAME": "COLOMBO",
"CONSTRAINT_COUNTRY_STATE": "SRILANKA"
}
]
},
{
"COUNTRY_ID": "1",
"COUNTRY_NAME": "INDIA",
"STATE": [
{
"STATE_ID": "1",
"STATE_NAME": "KARNATAKA",
"CONSTRAINT_COUNTRY_STATE": "INDIA"
}
]
}
]
}
Example 3: GET operation response in XML format with filtered data
The following is an example of OneData response to a GET request with the Accept header as application/xl, content-type as application/x-www-form-urlencoded, and the following filters:
filter={
"criterion" : [{
"criterion" : [{
"name" : "EMP_ID",
"operator" : "IN",
value" : "3"
}
]
}
}
}

The filter output is:
<EMP>
<datarow>
<EMP_ID>3</EMP_ID>
<EMP_NAME>EMP3</EMP_NAME>
<CONSTRAINT_COUNTRY_XML>IND</CONSTRAINT_COUNTRY_XML>
<CONSTRAINT_STATE>KARNATAKA</CONSTRAINT_STATE>
</datarow>
</EMP>
Example 4: GET operation response in JSON format with filtered data
The following is an example of OneData response to a GET request with the Accept header as application/json, content-type as application/x-www-form-urlencoded, and the following filters:
filter={
"criterion" : [{
"criterion" : [{
"name" : "EMP_ID",
"operator" : "IN",
"value" : "3"
}
]
}
]
}

The filter output is:
{
"EMP_7595": [
{
"EMP_ID": "3",
"EMP_NAME": "EMP3",
"CONSTRAINT_COUNTRY_XML": "IND",
"CONSTRAINT_STATE": "KARNATAKA"
}
]
}

Copyright © 2011-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release