Atualizar cashback
curl --request PUT \
--url https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id} \
--header 'Content-Type: application/json' \
--header 'User-Secret-Key: <api-key>' \
--header 'User-Token: <api-key>' \
--data '
{
"active": true,
"name": "Nome do cashback. Esse valor deve ser único.",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": true,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}"
payload = {
"active": True,
"name": "Nome do cashback. Esse valor deve ser único.",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": True,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"User-Token": "<api-key>",
"User-Secret-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'User-Token': '<api-key>',
'User-Secret-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
active: true,
name: 'Nome do cashback. Esse valor deve ser único.',
min_amount: 123,
max_amount: 123,
valid_for: 123,
percent_amount: 123,
has_expiration: true,
starts_at: '2023-11-07T05:31:56Z',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}', 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.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'active' => true,
'name' => 'Nome do cashback. Esse valor deve ser único.',
'min_amount' => 123,
'max_amount' => 123,
'valid_for' => 123,
'percent_amount' => 123,
'has_expiration' => true,
'starts_at' => '2023-11-07T05:31:56Z',
'expires_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"User-Secret-Key: <api-key>",
"User-Token: <api-key>"
],
]);
$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.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}"
payload := strings.NewReader("{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("User-Token", "<api-key>")
req.Header.Add("User-Secret-Key", "<api-key>")
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.put("https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}")
.header("User-Token", "<api-key>")
.header("User-Secret-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["User-Token"] = '<api-key>'
request["User-Secret-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"store_id": 123,
"token": "<string>",
"active": true,
"name": "Exemplo de cashback",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": true,
"starts_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"expires_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"created_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
}
}Cashback
Atualizar cashback
Atualiza os detalhes de um cashback específico
PUT
/
{alias}
/
pricing
/
cashbacks
/
{id}
Atualizar cashback
curl --request PUT \
--url https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id} \
--header 'Content-Type: application/json' \
--header 'User-Secret-Key: <api-key>' \
--header 'User-Token: <api-key>' \
--data '
{
"active": true,
"name": "Nome do cashback. Esse valor deve ser único.",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": true,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}"
payload = {
"active": True,
"name": "Nome do cashback. Esse valor deve ser único.",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": True,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"User-Token": "<api-key>",
"User-Secret-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'User-Token': '<api-key>',
'User-Secret-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
active: true,
name: 'Nome do cashback. Esse valor deve ser único.',
min_amount: 123,
max_amount: 123,
valid_for: 123,
percent_amount: 123,
has_expiration: true,
starts_at: '2023-11-07T05:31:56Z',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}', 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.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'active' => true,
'name' => 'Nome do cashback. Esse valor deve ser único.',
'min_amount' => 123,
'max_amount' => 123,
'valid_for' => 123,
'percent_amount' => 123,
'has_expiration' => true,
'starts_at' => '2023-11-07T05:31:56Z',
'expires_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"User-Secret-Key: <api-key>",
"User-Token: <api-key>"
],
]);
$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.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}"
payload := strings.NewReader("{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("User-Token", "<api-key>")
req.Header.Add("User-Secret-Key", "<api-key>")
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.put("https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}")
.header("User-Token", "<api-key>")
.header("User-Secret-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dooki.com.br/v2/{alias}/pricing/cashbacks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["User-Token"] = '<api-key>'
request["User-Secret-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": true,\n \"name\": \"Nome do cashback. Esse valor deve ser único.\",\n \"min_amount\": 123,\n \"max_amount\": 123,\n \"valid_for\": 123,\n \"percent_amount\": 123,\n \"has_expiration\": true,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"store_id": 123,
"token": "<string>",
"active": true,
"name": "Exemplo de cashback",
"min_amount": 123,
"max_amount": 123,
"valid_for": 123,
"percent_amount": 123,
"has_expiration": true,
"starts_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"expires_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"created_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2000-08-17 10:24:24",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
}
}Envie somente os campos obrigatórios e os que deseja alterar, para reduzir validações desnecessárias.
Caso não envie um campo, o mesmo será mantido com o valor atual.
Body
application/json
Estrutura de dados para criação e atualização de uma regra de cashback.
Response
Cashback atualizado com sucesso
Representa um cashback
Was this page helpful?