This documentation outlines the API endpoints for the SMS Gateway application. It details each endpoint's functionality, request/response structure, and example use cases.
The base URL serves as the entry point for all API requests:
{{base_url}}
Example: https://localhost:8080/
This endpoint retrieves all SMS messages stored on the server.
- Method:
GET
- URL:
{{base_url}}/sms
- Headers: None required
You can optionally include query parameters to filter results:
phone_number
(optional): Filter messages by the associated phone number.
GET https://localhost:8080/sms
- Status Code:
200 OK
- Body: JSON array containing SMS records
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
This endpoint allows you to send an SMS by providing a recipient's phone number and a message in the request body.
- Method:
POST
- URL:
{{base_url}}/sms
- Headers:
Content-Type
:application/json
- Body: JSON object
{ "number": "+1234567890", "message": "Hello, this is a test message!" }
POST https://localhost:8080/sms
Content-Type: application/json
{
"number": "+1234567890",
"message": "Hello, this is a test message!"
}
- Status Code:
200 OK
or201 Created
- Body: JSON confirmation of the message sent
pm.test("Successful POST request", function () {
pm.expect(pm.response.code).to.be.oneOf([200, 201]);
});
This endpoint deletes a specific SMS record by its unique identifier (id
).
- Method:
DELETE
- URL:
{{base_url}}/sms/:id
(Replace:id
with the actual SMS ID) - Headers: None required
- Body: Empty
DELETE https://localhost:8080/sms/2
- Status Code:
200 OK
202 Accepted
204 No Content
pm.test("Successful DELETE request", function () {
pm.expect(pm.response.code).to.be.oneOf([200, 202, 204]);
});
These variables allow dynamic usage of the API:
-
base_url
- Value:
https://localhost:8080/
- Description: The root URL for the API.
- Value:
-
id
- Value:
1
- Description: Represents the identifier for specific SMS records used in GET and DELETE requests.
- Value:
- Set the
base_url
variable to point to your API server. - Use the provided endpoints to perform CRUD operations.
- Ensure that you have a stable internet connection for server communication.
Each endpoint includes a predefined Postman test to verify expected behavior. These tests ensure:
- Correct status codes are returned (
200
,201
, etc.) - Proper response formats for all CRUD operations
No prerequest scripts are defined in the current configuration.
curl -X GET "{{base_url}}/sms"
curl -X POST "{{base_url}}/sms" \
-H "Content-Type: application/json" \
-d '{
"number": "+1234567890",
"message": "Hello, this is a test message!"
}'
curl -X DELETE "{{base_url}}/sms/2"
- This application is a proof-of-concept and may require additional features for production use.
- Ensure the server is configured correctly and accessible at the specified base URL.
For additional questions or support, refer to the development team.