What is a RESTful API?
REST stands for Representational State Transfer. It is a software architecture style that relies on a stateless communications protocol, most commonly, HTTP. REST structures data in XML, YAML, or any other format that is machine-readable, but usually JSON is most widely used. REST follows the object-oriented programming paradigm of noun-verb. REST is very data-driven, compared to SOAP, which is strongly function-driven. You may see people refer to them as RESTful APIs or RESTful web services. They mean the same thing and can be interchangeable.
There is no standard for the description format of REST services. You can import your REST service in SoapUI by using WADL files. Besides, ReadyAPI supports the OpenAPI, Swagger and RAML formats.
Your basic REST HTTP requests are: POST, GET, PUT, and DELETE. SoapUI supports HEAD, OPTIONS, TRACE, PATCH, PROPFIND, LOCK, UNLOCK, COPY and PURGE requests as well. Let’s look at an example from the Swagger Pet Store API:
- Sending a GET request to /pet/{petId} would retrieve pets with a specified ID from the database.
- Sending a POST request to /pet/{petId}/uploadImage would add a new image of the pet.
- Sending a PUT request to /pet/{petId} would update the attributes of an existing pet, identified by a specified id.
- Sending a DELETE request to /pet/{petId} would delete a specified pet.
So in a nutshell here is what each of these request types map to:
| GET | Read or retrieve data |
| POST | Add new data |
| PUT | Update data that already exists |
| DELETE | Remove data |
To learn more about REST requests and how to do them in SoapUI, please visit our Working with REST Requests page. You can also learn more about REST APIs on our REST vs SOAP page. Here, you will find pros and cons of each web service as well as example code.
Getting Started with REST APIs
In general, REST testing is sending different requests to a REST API and verifying responses from it. SoapUI supports extensive testing of RESTful web services and their resources, representations, and so on.
This step-by-step tutorial will help you learn how to send requests to a REST API and verify its responses with assertions in SoapUI. Follow along below with a quick demo using the Google Maps API to get you going. In just a few minutes, you’ll know how to create your first functional test of a RESTful web service — and it only takes a few clicks! Once you get the hang of it, start testing your own APIs!