Common Response Structure Example

The following example shows the JSON structure received in response to a request for the third page ("current_page_number") of fifteen ("total_page_count") in a multi-page response. The original query matched 30 epoch records ("total_count"), and the query specified that the response page should contain up to two records ("page_size").

The value.dataSummary.links section contains query URLs for requesting additional pages, such as page 0 (the first page), page 2 (the previous page), page 3 (this page), page 4 (the next page), and page 14 (the last page).

The value.data section contains the two data records included in this page.

{
   "success" : true,
   "messages" : [
     {
       "code" : 1001,
       "severity" : WARNING,
       "message" : "A warning message"
     }
   ],
   "value" : {
     "namespaces" : {
       "default" : "https://www.cisco.com/api/schema"
     },
     "dataSummary" : {
       "total_count" : 30,
       "has_more_data" : false,
       "page_size" : 2,
       "current_page_number" : 3,
       "total_page_count" : 15,
       "sort_fields" :  "epoch",
       "links" : [
          {
            "rel": "first",
            "href": "http://localhost:8443/api/v1/epochs?$page=0&$size=2"
          },
          {
            "rel": "prev",
            "href": "http://localhost:8443/api/v1/epochs?$page=2&$size=2"
          },
          {
            "rel": "next",
            "href": "http://localhost:8443/api/v1/epochs?$page=4&$size=2"
          },
          {
            "rel": "last",
            "href": "http://localhost:8443/api/v1/epochs?$page=14&$size=2"
          },
          {
            "rel": "self",
            "href": "http://localhost:8443/api/v1/epochs?$page=3&$size=2&$view=summary"
          }
       ]
     },
     "data" : [
        {
          "epoch": 6317663284849816765,
          "links": [
            {
              "rel": "self",
              "href": "http://localhost:8443/api/v1/epochs/6317663284849816765"
            }
          ],
          "updated_at": 1470959143974
        },
        {
          "epoch": 6317663284849816465,
          "links": [
            {
              "rel": "self",
              "href": "http://localhost:8443/api/v1/epochs/6317663284849816465"
            }
          ],
          "updated_at": 1470958842975
        }
     ]
   }
 }