MENU navbar-image

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."
}
 

Request      

GET api/user

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

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"
}
 

Request      

GET api/test

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Sahifa raqami. Example: 1

per_page   integer  optional  

Sahifada nechta element. Example: 15

search   string  optional  

Qidiruv so'zi (ixtiyoriy). Example: john

status   string  optional  

Foydalanuvchi holati. Example: active

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"
        ]
    }
}
 

Request      

POST api/test

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Foydalanuvchi ismi. Example: John Doe

email   string   

Email manzil. Example: john@example.com

password   string   

Parol (minimum 8 belgi). Example: secretpassword

phone   string  optional  

optional Telefon raqami. Example: +998901234567