Criar supressão
curl --request POST \
--url https://api.nasten.net/v1/webhook/suppressions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"interval": 10,
"suppressCount": 1,
"isActive": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({interval: 10, suppressCount: 1, isActive: true})
};
fetch('https://api.nasten.net/v1/webhook/suppressions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/webhook/suppressions"
payload = {
"interval": 10,
"suppressCount": 1,
"isActive": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/webhook/suppressions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'interval' => 10,
'suppressCount' => 1,
'isActive' => true
]),
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.nasten.net/v1/webhook/suppressions"
payload := strings.NewReader("{\n \"interval\": 10,\n \"suppressCount\": 1,\n \"isActive\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.nasten.net/v1/webhook/suppressions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"interval\": 10,\n \"suppressCount\": 1,\n \"isActive\": true\n}")
.asString();{
"success": true,
"data": {
"id": 7,
"companyId": "<string>",
"event": "transaction_created",
"interval": 10,
"suppressCount": 1,
"counter": 0,
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Webhooks
Criar supressão
A cada interval ocorrências do evento, as primeiras suppressCount não são entregues aos webhooks nem à postbackUrl.
Uma supressão por evento. Só tem efeito nos eventos de venda (transaction_*, card_declined, sale_lost);
nos demais a API aceita o cadastro, mas nada muda.
POST
/
v1
/
webhook
/
suppressions
Criar supressão
curl --request POST \
--url https://api.nasten.net/v1/webhook/suppressions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"interval": 10,
"suppressCount": 1,
"isActive": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({interval: 10, suppressCount: 1, isActive: true})
};
fetch('https://api.nasten.net/v1/webhook/suppressions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/webhook/suppressions"
payload = {
"interval": 10,
"suppressCount": 1,
"isActive": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/webhook/suppressions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'interval' => 10,
'suppressCount' => 1,
'isActive' => true
]),
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.nasten.net/v1/webhook/suppressions"
payload := strings.NewReader("{\n \"interval\": 10,\n \"suppressCount\": 1,\n \"isActive\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.nasten.net/v1/webhook/suppressions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"interval\": 10,\n \"suppressCount\": 1,\n \"isActive\": true\n}")
.asString();{
"success": true,
"data": {
"id": 7,
"companyId": "<string>",
"event": "transaction_created",
"interval": 10,
"suppressCount": 1,
"counter": 0,
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Body
application/json

