Query by using GET or POST methods

When you query OSLC resources, you can use either the HTTP GET method or HTTP POST method.

When you query OSLC resources by using HTTP GET, you specify the query parameters in the URI. If the URI is longer than 2000 characters, you must query by using HTTP POST, instead of HTTP GET. You can also use HTTP POST if the URI is less than 2000 characters but still long, or if you want to hide the query parameters so that they are not displayed in the URI.

When you query by using HTTP POST, you set the HTTP header Content-Type to application/x-www-form-urlencoded, send the URI without parameters, and specify the query parameters in the HTTP request body.

Example: Query by using HTTP GET

The following is an example of a query by using HTTP GET. All of the query parameters are displayed in the URI.

http://yourserver/oslc/spq/WorkTaskQuery?oslc.select=
spi:triNameTX,spi:RCA{spi:triRCARemedyCL}&oslc.where=
spi:RCA{spi:triRCARemedyCL="Clean"}&oslc.orderBy=%2Bspi:triNameTX

Example: Querying using HTTP POST

The following is an example of the same query by using HTTP POST. The URI becomes shortened.

http://yourserver1/oslc/spq/WorkTaskQuery

HTTP body

The HTTP request body contains all of the query parameters.

oslc.select=spi:triNameTX,spi:RCA{spi:triRCARemedyCL}&oslc.where=
spi:RCA{spi:triRCARemedyCL="Clean"}&oslc.orderBy=%2Bspi:triNameTX