Update Coupon Status (Use Coupon)
API Documentation for this endpoint
Endpoint Path
PUT <BASE_URL>/put/update-coupon-status
Request Parameters
| Type | Name | Required | Example Value |
|---|---|---|---|
| Request Body | coupon_code | Yes | ABC123XYZ |
Request Body
{
"coupon_code": "ABC123XYZ"
}
Response Status
| Status Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 404 | Not Found |
| 500 | Internal Server Error |
Response Body
- Success
- Bad Request
- Unauthorized
- Not Found
- Internal Server Error
{
"message": "Success"
}
{
"error_msg": "Coupon code ABC123XYZ has no remaining quantity left"
}
{
"error_msg": "API-KEY is invalid"
}
{
"error_msg": "Coupon code ABC123XYZ is not exist"
}
{
"error_msg": "Internal error occured, please check with our team"
}
Code Example to Request the Endpoint
- cURL
- Python
- PHP
curl -X PUT "<BASE_URL>/put/update-coupon-status" \
-H "Content-Type: application/json" \
-H "API-KEY: <YOUR_API_KEY>" \
-d '{
"coupon_code": "ABC123XYZ"
}'
import requests
url = "<BASE_URL>/put/update-coupon-status"
headers = {
"Content-Type": "application/json",
"API-KEY": "<YOUR_API_KEY>"
}
data = {
"coupon_code": "ABC123XYZ"
}
response = requests.put(url, json=data, headers=headers)
print(response.json())
<?php
$url = "<BASE_URL>/put/update-coupon-status";
$headers = array(
"Content-Type: application/json",
"API-KEY: <YOUR_API_KEY>"
);
$data = array(
"coupon_code" => "ABC123XYZ"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // to capture response as a string
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); // use PUT method
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); // attach JSON body
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // set headers
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Request Error: ' . curl_error($ch);
} else {
$responseData = json_decode($response, true);
print_r($responseData); // print decoded JSON response
}
curl_close($ch);
?>