There are many ways to interact with a web API. Many developers like to use the command line and use Curl. There is absolutely nothing wrong with that, and we encourage you to give it a try. However, for us, we prefer Postman, the industry standard GUI interface for interacting with Web APIs.
After downloading Postman, and setting up a quick account so you can save some collections, you’re ready to go. (We don’t earn any money from Postman, they’re just a great tool).
If you’d like to save time, you can right-click on this link and download and import our endpoint collections, which will give you in one big list all actionable items endpoints ready to go.
Anatomy of an API Call When You Use Postman
Let’s take a brief look at creating content, which will give us all the tools we need to do anything else we want with the API. For a full review of these topics, register at our developers portal.
This is a create call, also known as a POST. Here’s how it breaks down:
- A.Type of call: The 4 major types of calls are GET, POST, PATCH, PUT, and DELETE. To create an item, we choose POST.
- B. URL: This is the URL style of our Bestie I API. Change out the “10.0.1.7” for the IP Address of your Bestie I Brain. The information should be on your iOS app if you’re unsure.
- C. Headers: Normally this would be empty, but on our system you need to pass a Rune. This rune can be grabbed from the authorization system. For more info, check out the developer docs.
- D. Body: Body is where you pass information to the the system. In our case, we use JSON. See below for a sample call.
- E. Rune: Here is where you actually pass the value of the Rune.
- F. Send: Click this button to run your command!
Here’s the body of the create call, and the response we receive:
- A. Type of data: For our purposes here, always select “raw” unless you’re uploading skills.
- B. Format of data: JSON is the format we use, an industry standard.
- C. Body: The body is where we pass the information we want to interact with the database. For a POST, PUT, PATCH, and DELETE you will need to have some kind of body content. For more info about all the things you can pass in the body content, check out the developer docs.
- D. Response: This is the response from the brain. Here, you see it gives you what you gave it, plus adding “id” to each castle. The castle now each have an identifier in the system. The response comes back in JSON, and we selected “Pretty” here so it looks nice.
- E. Response codes: This is the standard http response value. 200 is good. Here’s a list of the codes.
With the knowledge you now have, and the list of over 40 endpoints from our Postman collection, you should be ready to take on most of the API. Always remember to include your Rune in the header, and any info you need in the body texts.
Happy hunting out there API heroes!