Thông tin API
Tạo đơn hàng
Để tạo đơn hàng, hãy gửi một yêu cầu POST tới API với payload dạng JSON như sau:
{
"link": "string",
"quantity": 0,
"service": 0,
"note": "string"
}
Ví dụ, dưới đây là cách tạo đơn hàng bằng JavaScript sử dụng fetch
với Bearer token:
fetch("https://api.dichvumat.com", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer your_token_here" // Thay "your_token_here" bằng token thực tế của bạn
},
body: JSON.stringify({
link: "https://example.com/product",
quantity: 1,
service: 123,
note: "Ghi chú đơn hàng"
})
})
.then(response => response.json())
.then(data => {
console.log("Đơn hàng được tạo:", data);
})
.catch(error => {
console.error("Lỗi khi tạo đơn hàng:", error);
});
Lấy thông tin đơn hàng
Để lấy thông tin đơn hàng của người dùng, hãy gửi một yêu cầu GET tới API với URL sau:
fetch("https://api.dichvumat.com/order/user/{id}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer your_token_here" // Thay "your_token_here" bằng token thực tế của bạn
}
})
.then(response => response.json())
.then(data => {
console.log("Thông tin đơn hàng:", data);
})
.catch(error => {
console.error("Lỗi khi lấy thông tin đơn hàng:", error);
});
Lưu ý: Thay {id}
bằng ID thực của đơn hàng.
Response Example
{
"ErrorCode": "SUCCESSFUL",
"Message": "Successfully!",
"Data": [
{
"order_createdAt": "2025-02-09T02:41:22.298Z",
"order_id": 1,
"order_link": "https://www.facebook.com/DienBeautySpa/videos/614899847851061",
"order_quantity": 50,
"order_amount": 30,
"order_price": 1800,
"order_status": "Complete",
"order_note": null
}
],
"AdditionalData": []
}