Query parameters

Content Platform Tenant Management Help

Version
9.7.x
File Size
4269 KB
Audience
anonymous
Part Number
MK-95HCPH002-19

Some HCP management API requests take query parameters. Query parameters are appended to a resource URL following a question mark (?). Multiple parameters are joined by ampersands (&).

The following considerations apply to query parameters:

  • If you specify an invalid value for a query parameter that requires a Boolean value (true or false), HCP interprets the value as false.
  • If you specify an invalid value for any other required or optional query parameter, HCP returns a status code of 400 (Bad Request).
  • If you omit a required query parameter, HCP returns a status code of 400 (Bad Request).
  • If you specify a query parameter that’s not valid for the request, HCP ignores it.

Query parameter names are case sensitive.

verbose

The verbose query parameter tells HCP how much information to return in response to a GET request for information about a resource. Valid values for this parameter are true and false.

In most cases, with verbose=false, a request for information about a resource returns only the properties whose values you can modify. For example, you cannot change the type of authentication for a user account. So, when you use GET with verbose=false to retrieve information about a user account, the localAuthentication property is omitted from the response body.

To retrieve all the properties for a resource, you need to append verbose=true to the resource URL. If you omit the verbose parameter, HCP uses the default value false.

prettyprint

The prettyprint query parameter causes the XML or JSON returned in response to a GET request to be formatted for readability. For example, with the prettyprint parameter, the returned XML for a list of namespaces looks like this:

<namespaces>
    <name>Accounts-Payable</name>
    <name>Accounts-Receivable</name>
</namespaces>

Without the prettyprint parameter, the returned XML looks like this:

<?xml version="1.0" encoding="UTF-8"?><namespaces><name>Accounts-Payable</name><name>Accounts-Receivable</name></namespaces>

The prettyprint parameter increases the time it takes to process a request. Therefore, you should use it only for testing purposes and not in production applications.

Request-specific query parameters

Some requests take query parameters that provide additional information to HCP about the operation you want to perform or that request a particular operation.

When the only action you’re requesting in a POST request for a resource other than a replication resource is specified by a query parameter, you need to provide an empty request body. With cURL, you specify this body as the argument for the -d option in the request:

With a content type of XML, the argument is an empty root element for the resource being modified, enclosed in double quotation marks, like this:

-d "<root-element/>"

For example, here’s a request to change only the password for the user account with the username mwhite:

curl -k -i -d "<userAccount/>" -H "Content-Type: application/xml"
    -H "Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6"
    "https://finance.hcp.example.com:9090/mapi/tenants/finance/
         userAccounts/mwhite?password=p4ssw0rd"

With a content type of JSON, the argument is an empty pair of curly braces enclosed in double quotation marks, like this:

-d "{}"