Introduction
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
This API is not authenticated.
Endpoints
GET api/user
Example request:
curl --request GET \
--get "http://api.temurtech.loc/api/user" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://api.temurtech.loc/api/user"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Foydalanuvchilar ro'yxatini olish
requires authentication
Bu endpoint barcha foydalanuvchilar ro'yxatini qaytaradi sahifabandlik bilan birga.
Example request:
curl --request GET \
--get "http://api.temurtech.loc/api/test?page=1&per_page=15&search=john&status=active" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://api.temurtech.loc/api/test"
);
const params = {
"page": "1",
"per_page": "15",
"search": "john",
"status": "active",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, success):
{
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"status": "active",
"created_at": "2024-01-01T12:00:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 100
}
}
Example response (401, unauthenticated):
{
"message": "Unauthenticated"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Yangi foydalanuvchi yaratish
requires authentication
Example request:
curl --request POST \
"http://api.temurtech.loc/api/test" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"John Doe\",
\"email\": \"john@example.com\",
\"password\": \"secretpassword\",
\"phone\": \"+998901234567\"
}"
const url = new URL(
"http://api.temurtech.loc/api/test"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "John Doe",
"email": "john@example.com",
"password": "secretpassword",
"phone": "+998901234567"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201, success):
{
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"phone": "+998901234567",
"created_at": "2024-01-01T12:00:00Z"
},
"message": "Foydalanuvchi muvaffaqiyatli yaratildi"
}
Example response (422, validation error):
{
"message": "The given data was invalid.",
"errors": {
"email": [
"Email allaqachon mavjud"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.