Criar cupom
curl --request POST \
--url https://alpa-sistema-api.onrender.com/api/v1/coupons \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"discountValue": 1,
"description": "<string>",
"minPurchaseCents": 1,
"maxDiscountCents": 1,
"usageLimit": 2,
"perUserLimit": 2,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"productIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"status": "ACTIVE"
}
'import requests
url = "https://alpa-sistema-api.onrender.com/api/v1/coupons"
payload = {
"code": "<string>",
"discountValue": 1,
"description": "<string>",
"minPurchaseCents": 1,
"maxDiscountCents": 1,
"usageLimit": 2,
"perUserLimit": 2,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"productIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"status": "ACTIVE"
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
discountValue: 1,
description: '<string>',
minPurchaseCents: 1,
maxDiscountCents: 1,
usageLimit: 2,
perUserLimit: 2,
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z',
productIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
status: 'ACTIVE'
})
};
fetch('https://alpa-sistema-api.onrender.com/api/v1/coupons', 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://alpa-sistema-api.onrender.com/api/v1/coupons",
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([
'code' => '<string>',
'discountValue' => 1,
'description' => '<string>',
'minPurchaseCents' => 1,
'maxDiscountCents' => 1,
'usageLimit' => 2,
'perUserLimit' => 2,
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z',
'productIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'status' => 'ACTIVE'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://alpa-sistema-api.onrender.com/api/v1/coupons"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-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.post("https://alpa-sistema-api.onrender.com/api/v1/coupons")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://alpa-sistema-api.onrender.com/api/v1/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"coupon": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"discountValue": 123,
"description": "<string>",
"minPurchaseCents": 123,
"maxDiscountCents": 123,
"usageLimit": 123,
"perUserLimit": 123,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"code": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"path": "<string>",
"errors": [
{}
]
}{
"message": "<string>"
}Cupom
Criar um novo Cupom
Cria um novo cupom de desconto
POST
/
api
/
v1
/
coupons
Criar cupom
curl --request POST \
--url https://alpa-sistema-api.onrender.com/api/v1/coupons \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"discountValue": 1,
"description": "<string>",
"minPurchaseCents": 1,
"maxDiscountCents": 1,
"usageLimit": 2,
"perUserLimit": 2,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"productIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"status": "ACTIVE"
}
'import requests
url = "https://alpa-sistema-api.onrender.com/api/v1/coupons"
payload = {
"code": "<string>",
"discountValue": 1,
"description": "<string>",
"minPurchaseCents": 1,
"maxDiscountCents": 1,
"usageLimit": 2,
"perUserLimit": 2,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"productIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"status": "ACTIVE"
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
discountValue: 1,
description: '<string>',
minPurchaseCents: 1,
maxDiscountCents: 1,
usageLimit: 2,
perUserLimit: 2,
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z',
productIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
status: 'ACTIVE'
})
};
fetch('https://alpa-sistema-api.onrender.com/api/v1/coupons', 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://alpa-sistema-api.onrender.com/api/v1/coupons",
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([
'code' => '<string>',
'discountValue' => 1,
'description' => '<string>',
'minPurchaseCents' => 1,
'maxDiscountCents' => 1,
'usageLimit' => 2,
'perUserLimit' => 2,
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z',
'productIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'status' => 'ACTIVE'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://alpa-sistema-api.onrender.com/api/v1/coupons"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-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.post("https://alpa-sistema-api.onrender.com/api/v1/coupons")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://alpa-sistema-api.onrender.com/api/v1/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"discountValue\": 1,\n \"description\": \"<string>\",\n \"minPurchaseCents\": 1,\n \"maxDiscountCents\": 1,\n \"usageLimit\": 2,\n \"perUserLimit\": 2,\n \"validFrom\": \"2023-11-07T05:31:56Z\",\n \"validUntil\": \"2023-11-07T05:31:56Z\",\n \"productIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"status\": \"ACTIVE\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"coupon": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"code": "<string>",
"discountValue": 123,
"description": "<string>",
"minPurchaseCents": 123,
"maxDiscountCents": 123,
"usageLimit": 123,
"perUserLimit": 123,
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"code": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"path": "<string>",
"errors": [
{}
]
}{
"message": "<string>"
}Authorizations
Chave de API obtida através do endpoint /api/credentials. Também aceita formato Bearer Token: Authorization: Bearer <api_key>
Body
application/json
Required string length:
3 - 50Available options:
PERCENTAGE, FIXED Required range:
x >= 0Maximum string length:
500Required range:
x >= 0Required range:
x >= 0Required range:
x >= 1Required range:
x >= 1Available options:
ACTIVE, INACTIVE ⌘I

