This post was updated in March 2023 in Testing REST-based Web Services.
Communicating with web services is fun and easy with Xojo. But sometimes it’s not so easy to test the actual REST API calls. As part of preparing materials for the HTTPSocket webinar, I created a simple app in Xojo that lets you test REST APIs. I call it RESTy.
RESTy uses Xojo.Net.HTTPSocket to send a request to a web service and get a result. If the result is text (JSON, for example) it displays in the Response tab. Here, I am calling the Eddie’s Electronics web service to return a list of all the customers by specifying the URL and clicking the Fetch button:
For other data (binary data such as pictures) you can use the Fetch to File button to save the request to a file.
The Authentication tab is used to provide Basic Authentication should the web service require it.
The Request Content tab can be used to provide Content data that the request might need. For example, the Eddie’s Electronics web service also lets you request the details for a specific customer by providing simple JSON containing the customer ID. For example:
You can put this JSON in the Request Content tab and then call the web service to get the customer information using this URL (be sure to select POST as the method type):
To be sure, RESTy is very simple, but you have the source code so feel free to add features to it!
If you’re looking for something with more features, there are also commercial products to test REST web services. Here are a few:
If you know of others, let me know in the comments.
Want to learn more about Xojo.Net.HTTPSocket and web services?