How to Perform a Basic API Test In 3 Steps

  February 07, 2018

If you’re looking to make quick and easy API calls to validate that your API is responding as it should, you’ve come to the right place. API testing tools can be inefficient when all that is needed is a quick check of an API. Writing code may not be everyone’s specialty either, which makes testing your API with Swagger Inspector the best option for any individual at any testing level.

Swagger Inspector makes API testing a breeze by allowing anyone to call an endpoint and see the results. This is not just great for testing, but also exploring a new API you are thinking about integrating with, or just curious about what kind of information you can receive from it. It’s free to use and doesn’t necessarily require a log in to use!

In this tutorial, we’ll go through how to make a basic API call with Swagger Inspector

For this example, we are going to use the Star Wars API. Mostly because I recently saw The Force Awakens (I have a lot of thoughts on the subject, unfortunately, this blog is not a think piece on The Force Awakens, please tweet us your thoughts if you also have opinions on this subject matter…), but also because it’s an API whose contents are easily understood by a variety of individuals.

Feel free to follow along and change out the examples with your own choice of endpoints.

Step 1 – Sign In

Open Inspector and sign in or sign up. If you already have a SwaggerHub account, you can sign in with those credentials. Signing up allows you save your history of calls, as well as be able to generate aOpenAPI definition when you’re ready.  

Step 2 - Download the Chrome Extension   

If this is your first time using Swagger Inspector, and you’re trying to inspect an API behind a firewall, you’ll need to download the Swagger Inspector Chrome extension. You won’t have

to leave the site to do so. If you're using Safari, "Disable Cross-Origin Restrictions" in Safari's developer options. This will be needed to access many of your APIs.  

The Star Wars API doesn’t require the extension download, but if you’d like to test out other APIs, then the extension will be critical to your testing success. 

Step 3 – Make the Call 

Paste your endpoint into the bar at the top of the page – hit send. 

In this example, I’m calling the GET method under the https://swapi.co/api/people/13 resource. Here's a hint about what information this resource will return...

Source - giphy

Great! Looks like all the right information is provided.

There you go, you’ve officially done a basic API test.  It's really that easy with Swagger Inspector. There's no set up time, no desktop downloads, no wait time. 

Try it out with your own API end points or keep going with the Star Wars API to get a feel for how Swagger Inspector works. Go ahead and try a couple of other endpoints to accumulate a variety of requests and try creating a collection or 2, and then generate an Open API definition! 

 To learn more about how Swagger Inspector can help you achieve API success, check out the Swagger Inspector page, and get started with testing your APIs today! 

We also created a video demo for you to follow along with if that’s more your speed. Below the video you can find a transcript. 

Try Swagger Inspector today!

 Transcript: 

Hi, my name is Shannon and I'm here to talk a little bit about Swagger Inspector today. 

It's our newest tool in the Swagger family and it's a product that we're really excited about! 

In particular, its ability to create API definitions is awesome and we know that what will keep people coming back to it, is the ability to go and make API calls over and over and categorize them.  

 Do everything that you would want to do when you're interacting with APIs and you need a UI  for to do that. 

 One of the things you can do with this tool is test your API endpoints. So, my favorite API of the moment is the Star Wars API. It's pretty awesome, you can go get the planets associated with the Star Wars universe.  

 Call the API for Star Wars and see that Tatooine is number 1 of the planets. 

 You can make API calls quickly and easily using Swagger Inspector and you can also pin your API calls. 

 You can take an API call and say “ok this is a favorite of mine I'm going to keep making that API call”. 

If you change your mind, just unpin requests and you can add those requests to collections to categorize calls. 

Another thing you can do is create the API definition so place a check either in your history of API calls or you can go straight to a collection and select all of the calls in a collection. 

Select specific calls in a collection and create your API definition. 

Once you do that, we're going to auto-generate this definition, so if you have multiple API calls you can select all of those. 

We're doing some refactoring behind the scenes making sure we understand the paths associated with your API, all of the query parameters you've used when using swagger inspector. 

Finally, when you get to creating your API, we're going to ask you for a name and then create your API definition with all of the information we know on about it based on those API calls. 

Once you are in SwaggerHub, that's where you're going to expand on your API. 

Add any specifics, like add a title here. This stores the API and all of these changes. 

You can save the API’s and do other cool things with them while in SwaggerHub. 

That's about all I have here for today for Swagger Inspector. 

Swagger Inspector is free, and we plan to keep it that way!