Logo
123 API Documentation

REST API basics: CRUD, test & variable

Number of APIs: 4


🚀 Get started here

This template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.

🔖 How to use this template

Step 1: Send requests

RESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.

This collection contains each of these [request] types. Open each request and click Send to see what happens.

Step 2: View responses

Observe the response tab for status code (200 OK), response time, and size.

Step 3: Send new Body data

Update or add new data in Body in the POST request. Typically, Body data is also used in PUT request.

{
    "name": "Add your name in the body"
}

Step 4: Update the variable

Variables enable you to store and reuse values in Qodex. We have created a [variable] called base_url with the sample request https://Qodex-api-learner.glitch.me. Replace it with your API endpoint to customize this collection.

Step 5: Add tests in the Scripts tab

Adding tests to your requests can help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the Test Results tab.

💪 Pro tips

  • Use folders to group related requests and organize the collection.

  • Add more [scripts] to verify if the API works as expected and execute workflows.

💡Related templates

API testing basics
API documentation
Authorization methods


1. Get data

GET {{base_url}}/info?id=1

This is a GET request and it is used to get data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have id=1).

A successful GET response will have a 200 OK status, and should include some kind of response body - for example, HTML web content or JSON data.



2. Post data

POST {{base_url}}/info

This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.

A successful POST request typically returns a 200 OK or 201 Created response code.



3. Update data

PUT {{base_url}}/info?id=1

This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. id=1).

A successful PUT request typically returns a 200 OK, 201 Created, or 204 No Content response code.



4. Delete data

DELETE {{base_url}}/info?id=1

This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. id=1).

A successful DELETE request typically returns a 200 OK, 202 Accepted, or 204 No Content response code.



ENDPOINTS