Atualizar desconto
curl --request PATCH \
--url https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"name": "<string>",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"rules": {
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123
},
"options": []
}
'import requests
url = "https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}"
payload = {
"code": "<string>",
"name": "<string>",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"rules": {
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123
},
"options": []
}
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({
code: '<string>',
name: '<string>',
startsAt: '2023-11-07T05:31:56Z',
endsAt: '2023-11-07T05:31:56Z',
rules: {value: 123, minimumOrderValue: 123, usageLimit: 123},
options: []
})
};
fetch('https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}', 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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}",
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([
'code' => '<string>',
'name' => '<string>',
'startsAt' => '2023-11-07T05:31:56Z',
'endsAt' => '2023-11-07T05:31:56Z',
'rules' => [
'value' => 123,
'minimumOrderValue' => 123,
'usageLimit' => 123
],
'options' => [
]
]),
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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}")
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 \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"type": "COUPON",
"code": "<string>",
"name": "<string>",
"status": "ACTIVE",
"rules": {
"valueType": "PERCENTAGE",
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123,
"usagePerCustomer": "ONCE",
"discountType": "TOTAL"
},
"options": [
"CUMULATIVE_WITH_SMART"
]
}{
"title": "Unauthorized",
"status": 401
}{
"status": "403",
"title": "growth_discount_not_hired"
}{
"status": "404",
"title": "Record not found"
}{
"status": "404",
"title": "Record not found"
}Ações
Atualizar desconto
Atualiza um desconto da loja. Envie apenas os campos que deseja alterar; o corpo pode ser enviado diretamente ou envolvido em {"discount": {...}}.
PATCH
/
merchant
/
v3
/
{merchantId}
/
discounts
/
{discountId}
Atualizar desconto
curl --request PATCH \
--url https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"name": "<string>",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"rules": {
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123
},
"options": []
}
'import requests
url = "https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}"
payload = {
"code": "<string>",
"name": "<string>",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"rules": {
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123
},
"options": []
}
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({
code: '<string>',
name: '<string>',
startsAt: '2023-11-07T05:31:56Z',
endsAt: '2023-11-07T05:31:56Z',
rules: {value: 123, minimumOrderValue: 123, usageLimit: 123},
options: []
})
};
fetch('https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}', 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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}",
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([
'code' => '<string>',
'name' => '<string>',
'startsAt' => '2023-11-07T05:31:56Z',
'endsAt' => '2023-11-07T05:31:56Z',
'rules' => [
'value' => 123,
'minimumOrderValue' => 123,
'usageLimit' => 123
],
'options' => [
]
]),
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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\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.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/discounts/{discountId}")
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 \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"startsAt\": \"2023-11-07T05:31:56Z\",\n \"endsAt\": \"2023-11-07T05:31:56Z\",\n \"rules\": {\n \"value\": 123,\n \"minimumOrderValue\": 123,\n \"usageLimit\": 123\n },\n \"options\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z",
"type": "COUPON",
"code": "<string>",
"name": "<string>",
"status": "ACTIVE",
"rules": {
"valueType": "PERCENTAGE",
"value": 123,
"minimumOrderValue": 123,
"usageLimit": 123,
"usagePerCustomer": "ONCE",
"discountType": "TOTAL"
},
"options": [
"CUMULATIVE_WITH_SMART"
]
}{
"title": "Unauthorized",
"status": 401
}{
"status": "403",
"title": "growth_discount_not_hired"
}{
"status": "404",
"title": "Record not found"
}{
"status": "404",
"title": "Record not found"
}Autorizações
Token de acesso opaco emitido pela API de autenticação (POST /authentication/v1/oauth/token).
Parâmetros de caminho
Id (UUID) da loja na plataforma. A loja precisa estar autorizada para o aplicativo.
Id (UUID) do desconto.
Corpo
application/json
Tipo do desconto.
Opções disponíveis:
COUPON, SMART Código do cupom (COUPON).
Nome do desconto inteligente (SMART).
Início da vigência.
Fim da vigência (opcional).
Show child attributes
Show child attributes
Opções do desconto.
Opções disponíveis:
CUMULATIVE_WITH_SMART, NON_PROMOTION_PRODUCTS, SUBSCRIBER Resposta
Desconto atualizado.
Omitido quando o desconto não tem fim de vigência.
Opções disponíveis:
COUPON, SMART Código do cupom. Presente apenas em COUPON.
Nome do desconto. Presente apenas em SMART.
Situação da vigência.
Opções disponíveis:
ACTIVE, SCHEDULED, OVERDUE Show child attributes
Show child attributes
Omitido quando não há opções.
Opções disponíveis:
CUMULATIVE_WITH_SMART, NON_PROMOTION_PRODUCTS, SUBSCRIBER