Tutorial: Designing A Basic REST API

Testing The API

With the HTTP server running and to close out this article we will perform some rudimentary testing of the API.

There are many tools available to test an API ranging from basic through to full load testing but one common tool used by all developers is the popular Postman application.  It is available in stand-alone binaries for all operating systems or as a very convenient Chrome browser plugin.

For those using Postman the ‘001 Basic’ directory contains a ‘test/’ subdirectory which includes a Postman collection file to import in to the application.

For others I will post screenshots below:

001 Basic GET

The image above demonstrates a successful GET request whilst the image below depicts a successful POST request.

001 Basic POST

To demonstrate our schema validation and handling of malformed data the picture below demonstrates an error response.

001 BAD Request

 

In future articles we will build upon this basic example and increase our knowledge and confidence in designing and developing APIs as well as more rigorous testing.

Was This Helpful?
All of the content on this site is presented without advertiser support and is produced exclusively by me. If you find any of this information useful please consider it against the cost of a course or book.

I gladly accept donations of any amount which goes directly towards producing more quality content and videos for this site.

[wpedon id=119]

Pages: 1 2 3 4 5 6

Written by YourAPIExpert