🔐 Autentifikatsiya
Har bir so'rovda quyidagi header yuborilishi kerak:
Authorization: Bearer your_token_here
POST
1. SMS Yuborish
https://devsms.uz/api/send_sms.php
Request Body:
{
"phone": "998901234567",
"message": "Test SMS xabari",
"from": "4546"
}
Parametrlar:
| Parametr | Turi | Majburiy | Tavsif |
|---|---|---|---|
| phone | string | Ha | Telefon raqam (998901234567 formatida) |
| message | string | Ha | SMS matni |
| from | string | Yo'q | Kimdan (default: 4546) |
Response:
{
"success": true,
"message": "SMS muvaffaqiyatli yuborildi",
"data": {
"sms_id": 123,
"request_id": "uuid-here",
"status": "waiting",
"parts_count": 1,
"total_cost": 50,
"balance": 950
}
}
GET
2. SMS Tarixini Olish
https://devsms.uz/api/get_history.php
Query Parametrlar:
| Parametr | Turi | Default | Tavsif |
|---|---|---|---|
| limit | integer | 50 | Nechta SMS (max: 200) |
| offset | integer | 0 | Offset |
| status | string | null | Status filter (DELIVERED, waiting, REJECTED) |
Misol:
GET https://devsms.uz/api/get_history.php?limit=10&offset=0&status=DELIVERED
GET
3. Balansni Olish
https://devsms.uz/api/get_balance.php
Response:
{
"success": true,
"data": {
"balance": 1000,
"sms_price": 50,
"statistics": {
"total_sms": 100,
"total_spent": 5000,
"today_sms": 10,
"today_spent": 500,
"month_sms": 50,
"month_spent": 2500
}
}
}
GET
4. SMS Statusini Olish
https://devsms.uz/api/get_status.php
Query Parametrlar:
| Parametr | Turi | Tavsif |
|---|---|---|
| sms_id | integer | SMS ID (database'dagi ID) |
| request_id | string | Eskiz request ID |
Misol:
GET https://devsms.uz/api/get_status.php?sms_id=123
yoki
GET https://devsms.uz/api/get_status.php?request_id=uuid-here
📝 SMS Statuslar
| Status | Tavsif |
|---|---|
| waiting | SMS kutish holatida |
| ACCEPTED | SMS operatorga yuborildi |
| DELIVERED | SMS yetkazildi |
| REJECTED | SMS rad etildi |
| UNDELIVERABLE | SMS yetkazilmadi |
❌ Xatoliklar
Xatolik yuz berganda quyidagi format qaytariladi:
{
"success": false,
"error": "Xatolik xabari"
}
HTTP Status Kodlar:
| Kod | Tavsif |
|---|---|
| 200 | Muvaffaqiyatli |
| 400 | Noto'g'ri so'rov |
| 401 | Autentifikatsiya xatosi |
| 403 | Ruxsat yo'q |
| 404 | Topilmadi |
| 500 | Server xatosi |
Maslahat:
API'ni test qilish uchun Postman yoki cURL ishlatishingiz mumkin.
🔧 cURL Misollari
SMS Yuborish:
curl -X POST https://devsms.uz/api/send_sms.php \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{
"phone": "998901234567",
"message": "Test SMS"
}'
Balansni Olish:
curl -X GET https://devsms.uz/api/get_balance.php \
-H "Authorization: Bearer your_token"