Obter campanha
curl --request GET \
--url https://api.example.com/v1/campaigns/{campaignId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/campaigns/{campaignId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/v1/campaigns/{campaignId}', 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.example.com/v1/campaigns/{campaignId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns/{campaignId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/campaigns/{campaignId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/{campaignId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"name": "Dia das mães",
"type": "advanced",
"startAt": "2024-06-05T09:00:00-03:00",
"features": [
"coupons",
"referrals"
],
"tags": [
"mães",
"maio"
],
"state": "enabled",
"status": "running",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "Campanha em comemoração ao dia das mães",
"endAt": "2030-06-05T23:59:59-03:00",
"loyaltySettings": {
"name": "Clube Pedir Gás",
"programJoinPolicy": "manualJoin",
"programExitPolicy": "keepPoints",
"programRedemptionPolicy": "automatic",
"description": "Programa de fidelidade do Clube Pedir Gás",
"defaultValidity": "5D",
"defaultPending": "5D",
"autoRedemptionSettings": {
"amount": 5,
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
}
},
"referralSettings": {
"name": "Clube Pedir Gás",
"pattern": "INDIQ######",
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"description": "Programa de indicação do Clube Pedir Gás",
"programRewardSettings": {
"activationTarget": 3,
"activationPolicy": "firstPurchase",
"advocateSettings": {
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
},
"friendSettings": {
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
}
}
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Campaigns
Obter campanha
Obtém a campanha existente pelo seu identificador.
GET
/
v1
/
campaigns
/
{campaignId}
Obter campanha
curl --request GET \
--url https://api.example.com/v1/campaigns/{campaignId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/campaigns/{campaignId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/v1/campaigns/{campaignId}', 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.example.com/v1/campaigns/{campaignId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns/{campaignId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/campaigns/{campaignId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/{campaignId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"name": "Dia das mães",
"type": "advanced",
"startAt": "2024-06-05T09:00:00-03:00",
"features": [
"coupons",
"referrals"
],
"tags": [
"mães",
"maio"
],
"state": "enabled",
"status": "running",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "Campanha em comemoração ao dia das mães",
"endAt": "2030-06-05T23:59:59-03:00",
"loyaltySettings": {
"name": "Clube Pedir Gás",
"programJoinPolicy": "manualJoin",
"programExitPolicy": "keepPoints",
"programRedemptionPolicy": "automatic",
"description": "Programa de fidelidade do Clube Pedir Gás",
"defaultValidity": "5D",
"defaultPending": "5D",
"autoRedemptionSettings": {
"amount": 5,
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
}
},
"referralSettings": {
"name": "Clube Pedir Gás",
"pattern": "INDIQ######",
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"description": "Programa de indicação do Clube Pedir Gás",
"programRewardSettings": {
"activationTarget": 3,
"activationPolicy": "firstPurchase",
"advocateSettings": {
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
},
"friendSettings": {
"couponSettings": {
"pattern": "CLUBE-######",
"discount": {
"type": "monetary",
"value": 120
},
"discountLimit": 120,
"validCharacters": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"validityDuration": "5D",
"pendingDuration": "5D"
}
}
}
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Esta página foi útil?
⌘I