Seller API (yozish)
Do‘konga bog‘langan kalit orqali o‘z zaxirangizni boshqaring — ISBN yoki shtrix-kod bo‘yicha yangilash.
Bu endpointlar faqat stock:write ability va do'koningizga bog'langan kalit bilan ishlaydi. POST so'rovlarda Idempotency-Key headerini yuboring.
POST
https://kitobchi.com/api/v1/client/products/stock/by-code
Zaxirani kod bo‘yicha yangilash
Do‘konga bog‘langan kalit orqali ISBN (kitob) yoki shtrix-kod (kanselyariya) bo‘yicha zaxirani o‘rnatadi (`stock`) yoki o‘zgartiradi (`delta`). `stock:write` ability va seller-scoped kalit talab qilinadi.
Body parametrlari
| Parametr | Turi | Talab | Tavsifi |
|---|---|---|---|
| code | string | majburiy | ISBN yoki shtrix-kod. |
| type | string | ixtiyoriy | book | stationery. Bo‘sh bo‘lsa avtomatik aniqlanadi. |
| stock | integer | ixtiyoriy | Yangi mutlaq zaxira (>= 0). |
| delta | integer | ixtiyoriy | Joriy zaxiraga qo‘shiladigan o‘zgarish (+/-). |
So'rov tanasi
json
{
"code": "9781847941831",
"stock": 25
}
curl --request POST \
--url 'https://kitobchi.com/api/v1/client/products/stock/by-code' \
--header 'Accept: application/json' \
--header 'X-App-ID: app_xxxxxxxxxxxx' \
--header 'X-App-Secret: your-secret' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: unique-123' \
--data '{"code":"9781847941831","stock":25}'
const res = await fetch("https://kitobchi.com/api/v1/client/products/stock/by-code", {
method: "POST",
headers: {
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": process.env.KITOBCHI_APP_SECRET,
"Content-Type": "application/json",
"Idempotency-Key": "unique-123",
},
body: JSON.stringify({
"code": "9781847941831",
"stock": 25
}),
});
const data = await res.json();
<?php
$ch = curl_init("https://kitobchi.com/api/v1/client/products/stock/by-code");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{"code":"9781847941831","stock":25}',
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
'X-App-ID: app_xxxxxxxxxxxx',
'X-App-Secret: ' . getenv('KITOBCHI_APP_SECRET'),
'Idempotency-Key: unique-123',
],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import os, requests
res = requests.request(
"POST",
"https://kitobchi.com/api/v1/client/products/stock/by-code",
headers={
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": os.environ["KITOBCHI_APP_SECRET"],
"Idempotency-Key": "unique-123",
},
json={
"code": "9781847941831",
"stock": 25
},
)
data = res.json()
Javob
200 OK
{
"status": "success",
"success": true,
"type": "book",
"id": 128,
"name": "Atomic Habits",
"stock": 25,
"in_stock": true
}
GET
https://kitobchi.com/api/v1/client/products/mine
Mening mahsulotlarim
Kalitga bog‘langan do‘konning mahsulotlari va zaxirasi (sahifalangan).
Query parametrlari
| Parametr | Turi | Talab | Tavsifi |
|---|---|---|---|
| type | string | ixtiyoriy | book (default) yoki stationery. |
| per_page | integer | ixtiyoriy | Sahifadagi soni (1–100). |
| page | integer | ixtiyoriy | Sahifa raqami. |
curl --request GET \ --url 'https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1' \ --header 'Accept: application/json' \ --header 'X-App-ID: app_xxxxxxxxxxxx' \ --header 'X-App-Secret: your-secret'
const res = await fetch("https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1", {
headers: {
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": process.env.KITOBCHI_APP_SECRET,
},
});
const data = await res.json();
<?php
$ch = curl_init("https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-App-ID: app_xxxxxxxxxxxx',
'X-App-Secret: ' . getenv('KITOBCHI_APP_SECRET'),
],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import os, requests
res = requests.get(
"https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1",
headers={
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": os.environ["KITOBCHI_APP_SECRET"],
},
)
data = res.json()
Javob
200 OK
{
"status": "success",
"data": [
{
"id": 128,
"type": "book",
"name": "Atomic Habits",
"code": "9781847941831",
"artikul": "10000128",
"price": 89000,
"stock": 25,
"in_stock": true,
"rating": 4.6,
"reviews_count": 87,
"deeplink": {
"web_url": "https://kitobchi.com/book/128",
"app_scheme_url": "kitobchi://book/128",
"smart_redirect_url": "https://kitobchi.com/r/book/128",
"short_url": "https://kitobchi.com/art/10000128"
}
}
],
"meta": {
"page": 1,
"per_page": 50,
"total": 240
}
}
Sinab ko'rish
X-App-ID
X-App-Secret
type
per_page
page
GET
https://kitobchi.com/api/v1/client/products/mine/reviews
Mening kitoblarim sharhlari
Do‘kon o‘z kitoblariga yozilgan sharhlarni o‘qiydi. Sharh va baho kitob kartasiga tegishli, shuning uchun bir xil kitobni sotayotgan do‘konlar bir xil sharhlarni ko‘radi. Mijoz ismi berilmaydi.
Query parametrlari
| Parametr | Turi | Talab | Tavsifi |
|---|---|---|---|
| code | string | ixtiyoriy | Bitta mahsulot uchun: ISBN yoki 8 xonali artikul. |
| per_page | integer | ixtiyoriy | Sahifadagi soni (1–100). |
| page | integer | ixtiyoriy | Sahifa raqami. |
curl --request GET \ --url 'https://kitobchi.com/api/v1/client/products/mine/reviews?code=9781847941831&per_page=20&page=1' \ --header 'Accept: application/json' \ --header 'X-App-ID: app_xxxxxxxxxxxx' \ --header 'X-App-Secret: your-secret'
const res = await fetch("https://kitobchi.com/api/v1/client/products/mine/reviews?code=9781847941831&per_page=20&page=1", {
headers: {
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": process.env.KITOBCHI_APP_SECRET,
},
});
const data = await res.json();
<?php
$ch = curl_init("https://kitobchi.com/api/v1/client/products/mine/reviews?code=9781847941831&per_page=20&page=1");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-App-ID: app_xxxxxxxxxxxx',
'X-App-Secret: ' . getenv('KITOBCHI_APP_SECRET'),
],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import os, requests
res = requests.get(
"https://kitobchi.com/api/v1/client/products/mine/reviews?code=9781847941831&per_page=20&page=1",
headers={
"Accept": "application/json",
"X-App-ID": "app_xxxxxxxxxxxx",
"X-App-Secret": os.environ["KITOBCHI_APP_SECRET"],
},
)
data = res.json()
Javob
200 OK
{
"status": "success",
"data": [
{
"id": 9012,
"product_id": 128,
"name": "Atomic Habits",
"code": "9781847941831",
"artikul": "10000128",
"text": "Juda foydali kitob.",
"score": 4.8,
"likes_count": 12,
"comments_count": 3,
"created_at": "2026-09-01T10:00:00+05:00"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 87
}
}
Sinab ko'rish
X-App-ID
X-App-Secret
code
per_page
page