ភូមិកសិផល Phoumika Kasiphal
សន្ទនា កន្ត្រក
REST API v1

ឯកសារ API

ឯកសារ REST API សម្រាប់ Client និង Integration។

JSON · UTF-8 · v4.5

Authentication

Endpoint ឯកជនប្រើ Secure Session Cookie ដែលមានស្រាប់។

គួរកំណត់ Rate Limit នៅ Nginx ឬ API Gateway មុនបើកជាសាធារណៈ។

Roles

super_admin, business_store, store, seller, buyer, viewer

កំណត់ចំនួនផលិតផល ចំនួនរូប ទំហំរូប/វីដេអូ និងសិទ្ធិលក់សម្រាប់តួនាទីនីមួយៗ។

GET/api/v1/locationsPublic

រាជធានី/ខេត្ត ក្រុង/ស្រុក/ខណ្ឌ ឃុំ/សង្កាត់ និងភូមិ ដែលអាចជ្រើសបានរួចជាស្រេច។

Query

type=province|municipality|district|commune|village
parent=01

Use the returned code as parent to load the next administrative level.

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint
GET/api/v1/productsPublic

ផលិតផលដែលបានបោះពុម្ព ជាមួយហាង តម្លៃ ស្តុក និងការផ្សព្វផ្សាយ។

Query

?q=tomato

Authenticated responses may include distance_km when both buyer and public store coordinates are available.

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint
GET/api/v1/storesPublic

ហាងសាធារណៈសកម្ម និងព័ត៌មានផ្ទៀងផ្ទាត់។

Exact coordinates are returned only for stores whose location visibility is public.

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint
GET/api/v1/meSession

Profile និងសមតុល្យ Wallet នៃគណនីដែលបាន Login។

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint
GET/api/v1/ordersSession

ការបញ្ជាទិញរបស់អ្នកទិញ ឬអ្នកលក់ដែលបាន Login។

Super admin sees all orders; selling roles see their store orders; buyers/viewers see their own orders.

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint
GET/api/v1/notificationsSession

ការជូនដំណឹងរបស់គណនីដែលបាន Login។

Response

{
  "data": [ ... ],
  "meta": { "count": 1 }
}
សាកល្បង Endpoint

ឧទាហរណ៍ API

curl -H "Accept: application/json" \
  "https://phumikasephal.com/api/v1/locations"

curl -H "Accept: application/json" \
  "https://phumikasephal.com/api/v1/products?q=rice"

Endpoint ឯកជន៖ ផ្ញើ Session Cookie ដែលបាន Login។