Batch request syntax
Batch request call syntax
The syntax for the batch request call is:
POST <applicationURL>/rest/<apiWithVersion>/batch
For example, if you were executing a Policy API batch from an instance of PolicyCenter on your local machine, the call would be:
POST http://localhost:8180/pc/rest/policy/v1/batch
Batch request payload syntax
The basic syntax for a batch request payload is:
{
"requests": [
{
"method": "<method>",
"path": "<path>",
"query": "<queryParameters>",
"data":
{
"attributes": {
"<field1>": "<value1>",
"<field2>": "<value2>",
...
}
}
},
{
"method": "<method>",
"path": "<path>",
"query": "<queryParameters>",
"data":
{
"attributes": {
"<field1>": "<value1>",
"<field2>": "<value2>",
...
}
}
},
...
]
}
where:
<method>
is the method in lower case, such as "get", "post", "patch", or "delete".<path>
is the endpoint path.- This path starts as if it was immediately following the API path
(including the major version, such as "
/v1
"). For example, suppose the path for a command when executed in isolation is:http://localhost:8180/pc/rest/policy/v1/policies/pc:22/activities/pc:55
. The path within a batch is:/policies/pc:22/activities/pc:55
- This path starts as if it was immediately following the API path
(including the major version, such as "
<queryParmaters>
is an optional string of query parameters. Start this string without an initial "?".<field1
/<value>
are the field and value pairs of the request body.
The following sections provide examples of how to use this syntax.
Optional subrequest attributes
A subrequest can optionally have query parameters that refine the corresponding subresponse payload.
By default, each subrequest inherits the information in the headers of the main request
object. The one exception to this is the GW-Checksum
header. This header is
not inherited because it is unlikely that a single checksum value will correspond to multiple
sub-requests. You can optionally specify header values for an individual subrequest, which
will override the corresponding values in the main request header.
If a subrequest fails, the default is to continue processing the remaining subrequests. For each subrequest, you can optionally specify that if the subrequest fails, PolicyCenter must skip the remaining subrequests.
For a complete list of options and further information on how they work, refer to the batch_pl-1.0.schema.json file.