You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Web APIs can pass in parameters in three different ways: 1.) Query Params, 2.) Request Headers, and 3.) Request Body. This article will explain how to retrieve the value of a parameter for each of these scenarios.

Query Params

Query params appear in the URL and are separated from the main resource endpoint with the question mark ("?") character and then followed with one or more parameters. Each parameter is separated with the ampersand ("&") character. Parameters normally take the form of a name/value pair. The equal sign ("=") character is used to separate the parameter name from the parameter value. Query params can appear alone as a label, but this rare and discouraged because the meaning of a label is ambiguous (e.g., Does a label without a value imply an empty value? Is a label with a value meant to be a value in and of itself by virtue of appearing in the URL?).

Here are a few examples:

GET https://www.examples.org/parts?color=red

GET https://www.examples.org/customers?status=active&state=NY

In your API you'll want to request the value of each query param. This could be done by parsing the full URL yourself (which is automatically stored in the FullEndpointURL variable). However, we recommend you use the GetQueryField service (which is a member of the HTTP_Services module). Here is what our code might look like:

// https://www.examples.org/parts?color=red
PartColor   = HTTP_Services('GetQueryField', 'color')
CustStatus  = HTTP_Services('GetQueryField', 'status')


// https://www.examples.org/customers?status=active&state=NY
CustState   = HTTP_Services('GetQueryField', 'state')

Note: query params are case sensitive.

Request Headers


Request Body


  • No labels