Getting Started

This is where you start appreciating the OPTIMO APIs and we have set up a nice guide for you on how to do it properly. As you spend more time with our APIS, you will feel like you cannot get enough of our APIs which is fair; there is no limit to what you can create using our APIs as a developer. So, hop on!

Your First OPTIMO API Call

Now we are stepping into the more serious territory, but we can keep the fun as usual. In this segment, you are going to test your first OPTIMO API request and retrieve some actual data and we are going to introduce few conventions that we will stick to in the rest of this guide. So let's pay close attention.

Our task here is to simply get a list of booking records. You can find what you need for this API request on our API Reference, and for this particular case, at Bookings - List. It says that you have to send a GET request at the end point /api/V4.1/bookings appended to the base URL.

In our convention, we would represent that as

GET ../api/V4.1/bookings

Remember, .. should always be replaced with the base URL of the OPTIMO system you are trying to interact with. Let's test this request in Postman!

There, select GET method and insert the endpoint next to it. Then you have to add your access-token as a header. Click on the Headers tab and insert the following.

Key

Value

token

{access-token}

Click Send to send the API request. You should get a rather lengthy JSON response similar to the one below.

In fact, you will get a much longer response with thousands of lines, since you are requesting all the booking records in the system (we just played a little trick here to to display only a couple of records which you will learn about later). Understanding the meaning of the different segments of the response actually takes a little bit of effort but the json:api specification will be your friend in that. We might give you some tips as we progress. But for a start,

  • "data"segment has the data we requested for. Inside it,

  • "type"is the type of the resource object we requested; we requested booking records, thus "booking".

  • "id" is the unique id given to this particular booking record in the system.

  • "attributes"gives the actual data for different attributes in the resource.

  • "relationships"describes relationships between this resource and other resources.

  • "links"contain links related to the resource.

Sometimes you might get the following error message as the response.

If that is the case, you need to get a fresh token by following the instructions at Authentication.

< Previous Next >