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 URI of an API. 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 searches for all of the pods in a cloud. 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 csm/Pod/search
Host: cloud.calbro.com
Authentication-Token: yourAuthenticationToken

{"timeout" : -1}

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 to search for all of the pods in a cloud. In the example, line 1 is the status line, lines 2 through 6 are header lines, line 7 is the empty line, and lines 8 through 30 contain the message body.


HTTP/1.1 200 OK
Date: Tue, 01 Feb 2011 21:39:12 GMT
BMC-Transaction-ID: fbbdc97f-89f3-4ec3-9911-9e156e9f87f5
Content-Type: application/json; charset=UTF-8
Content-Length: 978
Server:	Jetty(6.1.9)

[{
  "cloudClass" : "com.bmc.cloud.model.beans.SearchResults",
  "guid" : "13e716aa-c4f8-4e80-9044-47603aab75a1",
  "pageNo" : 0,
  "pageSize" : -1,
  "results" : [ {
    "cloudClass" : "com.bmc.cloud.model.beans.Pod",
    "containerBlueprints" : 
       [ "/containerblueprint/7aba0736-2684-41de-9da8-d715067c6aaa", 
         "/containerblueprint/9aba0736-2684-41de-9da8-d715067c6bbb" ],
    "containers" : [ "/networkcontainer/ff5080d6-e9f2-4dcc-847a-eafa5e2508b0" ],
    "externalID" : "392d97a1-efec-423c-a99d-848e1fe1ac35:Austin Pod",
    "guid" : "aae0c1b4-c391-4b58-8a36-654fdf2545e6",
    "isOnboarded" : true,
    "location" : "/location/c3ea7c30-2b2c-4db9-90bf-bd7ff9e95888",
    "name" : "Austin Pod",
    "provider" : "/provider/392d97a1-efec-423c-a99d-848e1fe1ac35",
    "reconciliationID" : "OI-66cfe9b940c240fda9986bee8cdec900",
    "staticPools" : [ "/staticpool/6687a3d3-8b4f-466c-a1e7-8e0f71964bc6" ],
    "tokenID" : "Austin Pod"
  } ],
  "totalRows" : 1
}]
Was this page helpful? Yes No Submitting... Thank you

Comments