API Fundamentals Lab

API Returned Data

You have made an API call, the server understood your request and now some data is returned!

This data is typically returned in either the JSON (JavaScript Object Notation) or XML (Extensible Markup Language) format. Apstra, like many modern REST APIs, uses the JSON format to return data. JSON is a widely used data interchange format that is easy to read and write and can be easily parsed by computers. You can use online resources such as the Mozilla Developer Network or a JSON formatter tool to help understand and interpret JSON data returned from an API.

Example API Request/Response

This section is just to give an idea of what a simple API request and response look like. If you would like to try this out yourself, REQBIN have a useful tool.

Example POST Request From A Client

You’ll notice in this example we are creating (POST) a transaction for John Smith.

POST /echo/post/json HTTP/1.1
Authorization: Bearer {token}
Host: reqbin.com
Content-Type: application/json
Content-Length: 80

{
  "Id": 12345,
  "Customer": "John Smith",
  "Quantity": 1,
  "Price": 10.00
}

Example Response From A Server

And the relpy is simply a response of {"success":"true"} and a Status code of 200 OK showing that the request was executed successfully.

HTTP/1.1 200 OK
Date: Tue, 24 Nov 2020 06:17:50 GMT
Content-Type: application/json
Content-Length: 19


{"success":"true"}