Query Parameters
Query parameters are used with GET requests to specify various conditions for retrieving resource records. When you perform a search by using a GET request on a resource endpoint, you put the query in the URL. Append a question mark (?) to the URL, followed by the parameter. A parameter is a key-value pair separated with an equals sign, that is, <url>?links=none. Multiple parameters can be used by separating them with an ampersand sign, that is, <url>?fields=name,workspace&links=none.
The following query parameters are supported in requests to the Intelligent Advisor Hub Administration REST APIs.
| Parameter | Description |
|---|---|
| expand | You can use the expand parameter to return a fully expanded version of a particular sub-resource. Use a comma-separated list of named resources to expand, or "all" to expand all. See 'Example for expand parameter' below. |
| fields | You can use the fields parameter to restrict the set of properties returned to only those you explicitly specify. The properties are specified as a comma-separated list. See 'Example for fields parameter' below. |
| links | You can use the links parameter to return only the specified, comma-separated set of links for a particular object. Use "none" to omit links. |
| q | For endpoints that return a list of items, you can use the q query parameter to specify a filter expression for restricting the set of the items returned. See GET Filtered Message Log Entries and GET Filtered Audit Entries. |
Example for expand parameter
A resource might be hierarchical and include parent-child relationships. For example, a deployment contains a summary and one or more versions. Each version can be represented as a separate resource so that a client can directly handle a version. For performance reasons, when a client issues a GET request against the parent resource, only links to the child resources are returned by default. For example:
{
"name": "Example",
"description": "Description of Example Project",
"compatibilityMode": "latest",
// ...
"versions": {
"links": [
// links ...
]
},
"logs": {
"links": [
// links ...
]
},
"links": [
// links ...
]
}
The expand query parameter provides the client an option of getting the child resources in line with its parent. For example, send GET /api/12.2.10/deployments/Example?expand=versions to get the versions child resources along with its summary:
{
"name": "Example",
"description": "Description of Example Project",
"compatibilityMode": "latest",
// ...
"versions": {
"items": [
{
"description": "Ad hoc project 'Example'. Deploy again.",
"versionNo": 5,
"addedBy": "admin",
"activeVersionFlag": false,
// ...
},
// more versions ...
],
"links": [
// links ...
]
},
"logs": {
"links": [
// links ...
]
},
"links": [
// links ...
]
}
If multiple child resources are to be expanded, then comma , is used to separate the names of the children, such as ?expand=versions,logs.
Finally, a client can use ?expand=all to get all the child resources.
Example for fields parameter
This query parameter is used to specify what fields should be returned. For example, given a response that consists of several fields:
{
"name": "Example",
"description": "Description of Example Project",
"compatibilityMode": "latest",
"services": [
// ...
],
// ...
"links": [
// links ...
]
}
A fields parameter specification of ?fields=name,description only returns name and description fields:
{
"name": "Example",
"description": "Description of Example Project",
"links": [
// links ...
]
}
Comma , is used to separate multiple field names. The links field is always returned.