Format of API examples

This topic describes the format used for the language-independent examples shown throughout the API documentation. The format is similar to the standard HTTP message transmission format. In practice, you create, send, and receive HTTP messages by using APIs supplied by an HTTP client library specific to your chosen programming language.

Format of HTTP request examples

HTTP request message examples consist of a request line, header lines, an empty line, and a message body.

The request line contains the HTTP method and the URL of an API. The URL is case-insensitive, except for the user input, for example, a process name or module name. The URL should specify the  component you are accessing and look like the following:

  • https://<hostname>:<port>/baocdp to log into a CDP
  • https://<hostname>:<port>/baoap to log into an AP

    Note

    Executing the command from an AP is supported in versions 7.9.01 and later.

In the URL <hostname> can be the fully qualified domain name (FQDN) or the IP address of the   server.

Header lines consist of a header name followed by a colon and the corresponding value (for a list of headers, see Common request headers). 

The message body is a JSON document.

The following example shows an HTTP request that executes a process. In the example, line 1 is the request line, lines 2 and 3 are header lines, line 4 is the empty line, and line 5 is the message body.

POST rest/process/execute
Host: <hostname>:<port>/baocdp
Authentication-Token: <yourAuthenticationToken>
{
    "inputParameters": [
        {
            "name": "adapter name",
            "value": "HTTP Adapter",
            "required": true
        },
        {
            "name": "url",
            "value": "http://www.google.com",
            "required": true
        }
    ]
}

Notes

  • Multibyte characters are accepted in strings in REST requests.
  • When providing string values containing double quotes, escape the double quotes with backslashes, as shown in the following example:

    {

        "inputParameters": [

            {

                "name": "json input",

                "value": "{\"input\":[{\"a1\":1}, {\"a2\": 2}]}"

            }

       ]

    }

Format of HTTP response examples

HTTP response message examples consist of a status line, header lines, an empty line, and a message body. The status line contains the HTTP protocol version, a numeric response code that indicates success or failure of the request, and a textual description of the response code. Header lines consist of a header name followed by a colon and the corresponding value (see common response headers for a list of headers). The message body is a JSON document.

The following example shows an HTTP response to a request execute a process. In the example, line 1 is the status line, lines 2 through 4 are header lines, line 5 is the empty line, and lines 6 through 8 contain the message body.

HTTP/1.1 200 OK
Date: Tue, 01 Feb 2013 21:39:12 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 978
{
	"processName":":AutoPilot-AD-Utilities:HTTP:Get",
	"jobId":"5856de51c2087c2c:-4ff9ed60:14b01befd3e:-7fed1-1424090865999",
}

Related topics

HTTP request and response headers

REST API TrueSight Orchestration calls reference

Was this page helpful? Yes No Submitting... Thank you

Comments