Get Affiliate Metrics
curl --request GET \
--url https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics', 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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics",
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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics"
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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics")
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{
"affiliate": {
"id": 1,
"name": "Afiliado Exemplo",
"ref_code": "AFFILIATE001",
"balance": 150
},
"commissions": {
"total_count": 25,
"total_value": 500,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 5,
"total": 100
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 3,
"total": 60
}
]
},
"withdraws": {
"total_count": 2,
"total_value": 200,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 1,
"total": 100
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 1,
"total": 100
}
]
},
"store_revenue": {
"total_count": 50,
"total_value": 5000,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 10,
"total": 1000
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 8,
"total": 800
}
]
}
}Afiliados
Get Affiliate Metrics
Retorna as métricas de um afiliado em um período específico.
GET
/
app
/
affiliate
/
{affiliate-id}
/
metrics
Get Affiliate Metrics
curl --request GET \
--url https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics', 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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics",
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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics"
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.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.centralcart.io/v1/app/affiliate/{affiliate-id}/metrics")
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{
"affiliate": {
"id": 1,
"name": "Afiliado Exemplo",
"ref_code": "AFFILIATE001",
"balance": 150
},
"commissions": {
"total_count": 25,
"total_value": 500,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 5,
"total": 100
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 3,
"total": 60
}
]
},
"withdraws": {
"total_count": 2,
"total_value": 200,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 1,
"total": 100
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 1,
"total": 100
}
]
},
"store_revenue": {
"total_count": 50,
"total_value": 5000,
"graph": [
{
"date": "2024-01-01T00:00:00.000Z",
"count": 10,
"total": 1000
},
{
"date": "2024-01-02T00:00:00.000Z",
"count": 8,
"total": 800
}
]
}
}Autorizações
Token de API gerado no painel da CentralCart.
Parâmetros de caminho
O ID do afiliado
Parâmetros de consulta
Data inicial do período no formato YYYY-MM-DD
Data final do período no formato YYYY-MM-DD