Partially update ecommerce coupon
curl --request PATCH \
--url https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"coupon": {
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": true,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": true,
"maxRedemptionsPerCode": 123,
"onlyForNewUsers": true,
"onlyForProductsWithoutDiscount": true,
"requirePhoneVerification": true,
"requiresCategoriesIds": [
"<string>"
],
"requiresProductsIds": [
"<string>"
],
"requiresStoresIds": [
"<string>"
],
"requiresMenusIds": [
"<string>"
],
"requiresPaymentTypes": [
"<string>"
],
"requireChannels": [
"<string>"
],
"requiredBINs": [
"<string>"
],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": [
"<string>"
],
"dontApplyDiscountToOptions": true,
"isHidden": true,
"allowedEmails": [
"<string>"
],
"externalId": "<string>",
"isBirthdayCoupon": true,
"onlyRedeemOnBirthday": true,
"autoRecommend": true,
"applyDeliveryDiscount": true,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123
}
}
'import requests
url = "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}"
payload = { "coupon": {
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": True,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": True,
"maxRedemptionsPerCode": 123,
"onlyForNewUsers": True,
"onlyForProductsWithoutDiscount": True,
"requirePhoneVerification": True,
"requiresCategoriesIds": ["<string>"],
"requiresProductsIds": ["<string>"],
"requiresStoresIds": ["<string>"],
"requiresMenusIds": ["<string>"],
"requiresPaymentTypes": ["<string>"],
"requireChannels": ["<string>"],
"requiredBINs": ["<string>"],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": ["<string>"],
"dontApplyDiscountToOptions": True,
"isHidden": True,
"allowedEmails": ["<string>"],
"externalId": "<string>",
"isBirthdayCoupon": True,
"onlyRedeemOnBirthday": True,
"autoRecommend": True,
"applyDeliveryDiscount": True,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
coupon: {
code: '<string>',
name: '<string>',
description: '<string>',
active: true,
percentageOff: 123,
maxPercentageOffDiscount: 123,
discountAmount: 123,
fixedAmount: 123,
fromDate: '2020-01-01T00:00:00.000Z',
endDate: '2020-01-01T00:00:00.000Z',
maxRedemptions: 123,
maxRedemptionsPerUser: 123,
maxRedemptionsPerUserPerDay: true,
maxRedemptionsPerCode: 123,
onlyForNewUsers: true,
onlyForProductsWithoutDiscount: true,
requirePhoneVerification: true,
requiresCategoriesIds: ['<string>'],
requiresProductsIds: ['<string>'],
requiresStoresIds: ['<string>'],
requiresMenusIds: ['<string>'],
requiresPaymentTypes: ['<string>'],
requireChannels: ['<string>'],
requiredBINs: ['<string>'],
minimumOrderPrice: 123,
maximumOrderPrice: 123,
dontApplyToProductsIds: ['<string>'],
dontApplyDiscountToOptions: true,
isHidden: true,
allowedEmails: ['<string>'],
externalId: '<string>',
isBirthdayCoupon: true,
onlyRedeemOnBirthday: true,
autoRecommend: true,
applyDeliveryDiscount: true,
deliveryDiscountValue: 123,
deliveryDiscountType: '<string>',
deliveryDiscountPercentage: 123,
maxProductsPerOrder: 123
}
})
};
fetch('https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'coupon' => [
'code' => '<string>',
'name' => '<string>',
'description' => '<string>',
'active' => true,
'percentageOff' => 123,
'maxPercentageOffDiscount' => 123,
'discountAmount' => 123,
'fixedAmount' => 123,
'fromDate' => '2020-01-01T00:00:00.000Z',
'endDate' => '2020-01-01T00:00:00.000Z',
'maxRedemptions' => 123,
'maxRedemptionsPerUser' => 123,
'maxRedemptionsPerUserPerDay' => true,
'maxRedemptionsPerCode' => 123,
'onlyForNewUsers' => true,
'onlyForProductsWithoutDiscount' => true,
'requirePhoneVerification' => true,
'requiresCategoriesIds' => [
'<string>'
],
'requiresProductsIds' => [
'<string>'
],
'requiresStoresIds' => [
'<string>'
],
'requiresMenusIds' => [
'<string>'
],
'requiresPaymentTypes' => [
'<string>'
],
'requireChannels' => [
'<string>'
],
'requiredBINs' => [
'<string>'
],
'minimumOrderPrice' => 123,
'maximumOrderPrice' => 123,
'dontApplyToProductsIds' => [
'<string>'
],
'dontApplyDiscountToOptions' => true,
'isHidden' => true,
'allowedEmails' => [
'<string>'
],
'externalId' => '<string>',
'isBirthdayCoupon' => true,
'onlyRedeemOnBirthday' => true,
'autoRecommend' => true,
'applyDeliveryDiscount' => true,
'deliveryDiscountValue' => 123,
'deliveryDiscountType' => '<string>',
'deliveryDiscountPercentage' => 123,
'maxProductsPerOrder' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}"
payload := strings.NewReader("{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "<string>",
"websiteId": "<string>",
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": true,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": true,
"maxRedemptionsPerCode": 123,
"totalRedemptions": 123,
"onlyForNewUsers": true,
"onlyForProductsWithoutDiscount": true,
"requirePhoneVerification": true,
"requiresCategoriesIds": [
"<string>"
],
"requiresProductsIds": [
"<string>"
],
"requiresStoresIds": [
"<string>"
],
"requiresMenusIds": [
"<string>"
],
"requiresPaymentTypes": [
"<string>"
],
"requireChannels": [
"<string>"
],
"requiredBINs": [
"<string>"
],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": [
"<string>"
],
"dontApplyDiscountToOptions": true,
"isHidden": true,
"allowedEmails": [
"<string>"
],
"externalId": "<string>",
"isBirthdayCoupon": true,
"onlyRedeemOnBirthday": true,
"autoRecommend": true,
"applyDeliveryDiscount": true,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123,
"createdAt": "2020-01-01T00:00:00.000Z",
"deletedAt": "2020-01-01T00:00:00.000Z"
}
}{
"success": "false",
"error": {
"error": "error",
"message": "The request has an error"
}
}Cupones
Partially update ecommerce coupon
Actualiza parcialmente un cupón ecommerce. Funciona igual que PUT, pero se documenta para integraciones que separan reemplazo y edición parcial.
PATCH
/
ecommerce
/
coupons
/
{couponId}
Partially update ecommerce coupon
curl --request PATCH \
--url https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"coupon": {
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": true,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": true,
"maxRedemptionsPerCode": 123,
"onlyForNewUsers": true,
"onlyForProductsWithoutDiscount": true,
"requirePhoneVerification": true,
"requiresCategoriesIds": [
"<string>"
],
"requiresProductsIds": [
"<string>"
],
"requiresStoresIds": [
"<string>"
],
"requiresMenusIds": [
"<string>"
],
"requiresPaymentTypes": [
"<string>"
],
"requireChannels": [
"<string>"
],
"requiredBINs": [
"<string>"
],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": [
"<string>"
],
"dontApplyDiscountToOptions": true,
"isHidden": true,
"allowedEmails": [
"<string>"
],
"externalId": "<string>",
"isBirthdayCoupon": true,
"onlyRedeemOnBirthday": true,
"autoRecommend": true,
"applyDeliveryDiscount": true,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123
}
}
'import requests
url = "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}"
payload = { "coupon": {
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": True,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": True,
"maxRedemptionsPerCode": 123,
"onlyForNewUsers": True,
"onlyForProductsWithoutDiscount": True,
"requirePhoneVerification": True,
"requiresCategoriesIds": ["<string>"],
"requiresProductsIds": ["<string>"],
"requiresStoresIds": ["<string>"],
"requiresMenusIds": ["<string>"],
"requiresPaymentTypes": ["<string>"],
"requireChannels": ["<string>"],
"requiredBINs": ["<string>"],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": ["<string>"],
"dontApplyDiscountToOptions": True,
"isHidden": True,
"allowedEmails": ["<string>"],
"externalId": "<string>",
"isBirthdayCoupon": True,
"onlyRedeemOnBirthday": True,
"autoRecommend": True,
"applyDeliveryDiscount": True,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
coupon: {
code: '<string>',
name: '<string>',
description: '<string>',
active: true,
percentageOff: 123,
maxPercentageOffDiscount: 123,
discountAmount: 123,
fixedAmount: 123,
fromDate: '2020-01-01T00:00:00.000Z',
endDate: '2020-01-01T00:00:00.000Z',
maxRedemptions: 123,
maxRedemptionsPerUser: 123,
maxRedemptionsPerUserPerDay: true,
maxRedemptionsPerCode: 123,
onlyForNewUsers: true,
onlyForProductsWithoutDiscount: true,
requirePhoneVerification: true,
requiresCategoriesIds: ['<string>'],
requiresProductsIds: ['<string>'],
requiresStoresIds: ['<string>'],
requiresMenusIds: ['<string>'],
requiresPaymentTypes: ['<string>'],
requireChannels: ['<string>'],
requiredBINs: ['<string>'],
minimumOrderPrice: 123,
maximumOrderPrice: 123,
dontApplyToProductsIds: ['<string>'],
dontApplyDiscountToOptions: true,
isHidden: true,
allowedEmails: ['<string>'],
externalId: '<string>',
isBirthdayCoupon: true,
onlyRedeemOnBirthday: true,
autoRecommend: true,
applyDeliveryDiscount: true,
deliveryDiscountValue: 123,
deliveryDiscountType: '<string>',
deliveryDiscountPercentage: 123,
maxProductsPerOrder: 123
}
})
};
fetch('https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'coupon' => [
'code' => '<string>',
'name' => '<string>',
'description' => '<string>',
'active' => true,
'percentageOff' => 123,
'maxPercentageOffDiscount' => 123,
'discountAmount' => 123,
'fixedAmount' => 123,
'fromDate' => '2020-01-01T00:00:00.000Z',
'endDate' => '2020-01-01T00:00:00.000Z',
'maxRedemptions' => 123,
'maxRedemptionsPerUser' => 123,
'maxRedemptionsPerUserPerDay' => true,
'maxRedemptionsPerCode' => 123,
'onlyForNewUsers' => true,
'onlyForProductsWithoutDiscount' => true,
'requirePhoneVerification' => true,
'requiresCategoriesIds' => [
'<string>'
],
'requiresProductsIds' => [
'<string>'
],
'requiresStoresIds' => [
'<string>'
],
'requiresMenusIds' => [
'<string>'
],
'requiresPaymentTypes' => [
'<string>'
],
'requireChannels' => [
'<string>'
],
'requiredBINs' => [
'<string>'
],
'minimumOrderPrice' => 123,
'maximumOrderPrice' => 123,
'dontApplyToProductsIds' => [
'<string>'
],
'dontApplyDiscountToOptions' => true,
'isHidden' => true,
'allowedEmails' => [
'<string>'
],
'externalId' => '<string>',
'isBirthdayCoupon' => true,
'onlyRedeemOnBirthday' => true,
'autoRecommend' => true,
'applyDeliveryDiscount' => true,
'deliveryDiscountValue' => 123,
'deliveryDiscountType' => '<string>',
'deliveryDiscountPercentage' => 123,
'maxProductsPerOrder' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}"
payload := strings.NewReader("{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.service.getjusto.com/v3/ecommerce/coupons/{couponId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"coupon\": {\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"percentageOff\": 123,\n \"maxPercentageOffDiscount\": 123,\n \"discountAmount\": 123,\n \"fixedAmount\": 123,\n \"fromDate\": \"2020-01-01T00:00:00.000Z\",\n \"endDate\": \"2020-01-01T00:00:00.000Z\",\n \"maxRedemptions\": 123,\n \"maxRedemptionsPerUser\": 123,\n \"maxRedemptionsPerUserPerDay\": true,\n \"maxRedemptionsPerCode\": 123,\n \"onlyForNewUsers\": true,\n \"onlyForProductsWithoutDiscount\": true,\n \"requirePhoneVerification\": true,\n \"requiresCategoriesIds\": [\n \"<string>\"\n ],\n \"requiresProductsIds\": [\n \"<string>\"\n ],\n \"requiresStoresIds\": [\n \"<string>\"\n ],\n \"requiresMenusIds\": [\n \"<string>\"\n ],\n \"requiresPaymentTypes\": [\n \"<string>\"\n ],\n \"requireChannels\": [\n \"<string>\"\n ],\n \"requiredBINs\": [\n \"<string>\"\n ],\n \"minimumOrderPrice\": 123,\n \"maximumOrderPrice\": 123,\n \"dontApplyToProductsIds\": [\n \"<string>\"\n ],\n \"dontApplyDiscountToOptions\": true,\n \"isHidden\": true,\n \"allowedEmails\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\",\n \"isBirthdayCoupon\": true,\n \"onlyRedeemOnBirthday\": true,\n \"autoRecommend\": true,\n \"applyDeliveryDiscount\": true,\n \"deliveryDiscountValue\": 123,\n \"deliveryDiscountType\": \"<string>\",\n \"deliveryDiscountPercentage\": 123,\n \"maxProductsPerOrder\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "<string>",
"websiteId": "<string>",
"code": "<string>",
"name": "<string>",
"description": "<string>",
"active": true,
"percentageOff": 123,
"maxPercentageOffDiscount": 123,
"discountAmount": 123,
"fixedAmount": 123,
"fromDate": "2020-01-01T00:00:00.000Z",
"endDate": "2020-01-01T00:00:00.000Z",
"maxRedemptions": 123,
"maxRedemptionsPerUser": 123,
"maxRedemptionsPerUserPerDay": true,
"maxRedemptionsPerCode": 123,
"totalRedemptions": 123,
"onlyForNewUsers": true,
"onlyForProductsWithoutDiscount": true,
"requirePhoneVerification": true,
"requiresCategoriesIds": [
"<string>"
],
"requiresProductsIds": [
"<string>"
],
"requiresStoresIds": [
"<string>"
],
"requiresMenusIds": [
"<string>"
],
"requiresPaymentTypes": [
"<string>"
],
"requireChannels": [
"<string>"
],
"requiredBINs": [
"<string>"
],
"minimumOrderPrice": 123,
"maximumOrderPrice": 123,
"dontApplyToProductsIds": [
"<string>"
],
"dontApplyDiscountToOptions": true,
"isHidden": true,
"allowedEmails": [
"<string>"
],
"externalId": "<string>",
"isBirthdayCoupon": true,
"onlyRedeemOnBirthday": true,
"autoRecommend": true,
"applyDeliveryDiscount": true,
"deliveryDiscountValue": 123,
"deliveryDiscountType": "<string>",
"deliveryDiscountPercentage": 123,
"maxProductsPerOrder": 123,
"createdAt": "2020-01-01T00:00:00.000Z",
"deletedAt": "2020-01-01T00:00:00.000Z"
}
}{
"success": "false",
"error": {
"error": "error",
"message": "The request has an error"
}
}Actualiza parcialmente un cupón ecommerce de la marca autorizada. Úsalo para cambios acotados como activar o desactivar el cupón, ajustar fechas, cambiar límites o editar una condición.
En Justo Admin MCP esta operación requiere confirmación explícita del usuario porque modifica reglas de descuento.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID Justo o externalId del cupón.
Body
application/json
Campos para actualizar un cupón ecommerce. Todos los campos son opcionales.
Show child attributes
Show child attributes
⌘I