Introduction
This API allows you to perform create, read, update, and delete operations on user records. Each record contains an ID, name, age, and country. Built for educational use, it's free and easy to integrate.
Base URL: http://ninjatech.space/api/users
Data Structure
User objects are represented in JSON format as follows:
{
"id": 19,
"name": "rahul",
"age": 21,
"country": "south asia"
}
API Endpoints
GET /
Fetches a list of all users.
Example Response:
[
{
"id": 19,
"name": "rahul",
"age": 21,
"country": "south asia"
},
// More users...
]
GET /:id
Retrieves a specific user by their ID.
Example Response:
{
"id": 19,
"name": "rahul",
"age": 21,
"country": "south asia"
}
POST /
Creates a new user record. Include JSON data in the request body.
Example Request Body:
{
"name": "rahul",
"age": 21,
"country": "south asia"
}
Example Response:
{
"id": 20,
"name": "rahul",
"age": 21,
"country": "south asia"
}
PUT /:id
Updates an existing user record by ID. Provide updated JSON in the request body.
Example Request Body:
{
"name": "rahul updated",
"age": 22,
"country": "south asia"
}
Example Response:
{
"id": 19,
"name": "rahul updated",
"age": 22,
"country": "south asia"
}
DELETE /:id
Deletes a user record by ID.
Example Response: 204 No Content
Usage Examples
Interact with the API using tools like Postman, curl, or JavaScript's fetch API.
curl Example (GET all users):
curl http://ninjatech.space/api/users