curl --request GET \
--url https://api.example.com/v1/campaigns \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/campaigns"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns")
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"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"keyset": "<string>",
"count": 123,
"totalCount": 123
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Listar campanhas
Lista as campanhas aplicando os filtros informados.
curl --request GET \
--url https://api.example.com/v1/campaigns \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/campaigns"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns")
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"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"keyset": "<string>",
"count": 123,
"totalCount": 123
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Parâmetros de consulta
Número de registros a serem retornados
50
Número do começo de registros a serem retornados.
Nota: Limitado a 10.000 registros. Recomendamos a utilização do keyset para paginação continua.
0
Identificador usado para paginação baseada em cursor.
Nota: Somente será considerado caso o valor do campo offset seja 0.
"cGl0OmJXRnBibDlwYm1SbGVDNXdjbWx0WVhKNTpbMTcwMDAwMDAwMDAwMF0="
Termo da pesquisa
"Dia das mães"
Filtra pela data de início da vigência igual ou inferior.
É esperada uma string de timestamp no formato RFC3339.
"2024-06-05T09:00:00-03:00"
Filtra pela data de início da vigência igual ou superior.
É esperada uma string de timestamp no formato RFC3339.
"2024-06-05T09:00:00-03:00"
Filtra pela data de término da vigência igual ou inferior.
É esperada uma string de timestamp no formato RFC3339.
"2030-06-05T23:59:59-03:00"
Filtra pela data de término da vigência igual ou superior.
É esperada uma string de timestamp no formato RFC3339.
"2030-06-05T23:59:59-03:00"
Filtra pelos recursos para a campanha
coupons, referrals, loyalty, giveaways ["coupons", "referrals"]
Filtra pelas tags das campanhas
["mães", "maio"]
Filtra pelos estados das campanhas
draft, enabled, disabled, archived ["enabled"]
Filtra pelas situações das campanhas
draft, disabled, archived, scheduled, running, expired ["running"]
Esta página foi útil?