Criar upsell
curl --request POST \
--url https://api.speedsellx.io/v2/public/upsells \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "<string>",
"product_id": 2,
"product_link_id": 2,
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>"
}
'import requests
url = "https://api.speedsellx.io/v2/public/upsells"
payload = {
"name": "<string>",
"product_id": 2,
"product_link_id": 2,
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
product_id: 2,
product_link_id: 2,
accept_text: '<string>',
refuse_text: '<string>',
accept_page: '<string>',
refuse_page: '<string>'
})
};
fetch('https://api.speedsellx.io/v2/public/upsells', 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.speedsellx.io/v2/public/upsells",
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([
'name' => '<string>',
'product_id' => 2,
'product_link_id' => 2,
'accept_text' => '<string>',
'refuse_text' => '<string>',
'accept_page' => '<string>',
'refuse_page' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.speedsellx.io/v2/public/upsells"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.speedsellx.io/v2/public/upsells")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedsellx.io/v2/public/upsells")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"seller_id": 123,
"funnel_id": 123,
"product_id": 123,
"product_link_id": 123,
"name": "<string>",
"status": "<string>",
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>",
"accept_redirect": "<string>",
"refuse_redirect": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"status": "error",
"error": "unauthenticated"
}{
"status": "error",
"error": "insufficient_scope"
}{
"status": "error",
"error": "not_found"
}{
"status": "error",
"error": "idempotency_in_progress"
}{
"message": "<string>",
"errors": {}
}Upsells
Criar upsell
Cria uma oferta de upsell
POST
/
public
/
upsells
Criar upsell
curl --request POST \
--url https://api.speedsellx.io/v2/public/upsells \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "<string>",
"product_id": 2,
"product_link_id": 2,
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>"
}
'import requests
url = "https://api.speedsellx.io/v2/public/upsells"
payload = {
"name": "<string>",
"product_id": 2,
"product_link_id": 2,
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
product_id: 2,
product_link_id: 2,
accept_text: '<string>',
refuse_text: '<string>',
accept_page: '<string>',
refuse_page: '<string>'
})
};
fetch('https://api.speedsellx.io/v2/public/upsells', 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.speedsellx.io/v2/public/upsells",
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([
'name' => '<string>',
'product_id' => 2,
'product_link_id' => 2,
'accept_text' => '<string>',
'refuse_text' => '<string>',
'accept_page' => '<string>',
'refuse_page' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.speedsellx.io/v2/public/upsells"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.speedsellx.io/v2/public/upsells")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedsellx.io/v2/public/upsells")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"product_id\": 2,\n \"product_link_id\": 2,\n \"accept_text\": \"<string>\",\n \"refuse_text\": \"<string>\",\n \"accept_page\": \"<string>\",\n \"refuse_page\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"seller_id": 123,
"funnel_id": 123,
"product_id": 123,
"product_link_id": 123,
"name": "<string>",
"status": "<string>",
"accept_text": "<string>",
"refuse_text": "<string>",
"accept_page": "<string>",
"refuse_page": "<string>",
"accept_redirect": "<string>",
"refuse_redirect": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"status": "error",
"error": "unauthenticated"
}{
"status": "error",
"error": "insufficient_scope"
}{
"status": "error",
"error": "not_found"
}{
"status": "error",
"error": "idempotency_in_progress"
}{
"message": "<string>",
"errors": {}
}Requer o escopo
Um
upsells:write e o header HTTP Idempotency-Key.
A oferta entra no funil do produto indicado em product_id, e esse funil é aberto quando o produto ainda não tem um.
Sem
status no corpo, a oferta nasce published. A API antiga criava em draft, o que produzia ofertas que o funil pulava. Envie status: "draft" se você quer o comportamento antigo.accept_redirect e refuse_redirect não são aceitos e derrubam a requisição com 422. Eles continuam aparecendo na leitura da oferta; só não podem ser escritos por aqui.product_id que não é da sua conta retorna 404, a mesma resposta de um produto que não existe.Authorizations
A chave de API da conta, no formato sk_{modo}_{prefixo}.{segredo}.
Headers
Chave única da operação. Obrigatória em toda requisição que altera dados; sem ela a resposta é 422 idempotency_key_required. Um reenvio com a mesma chave e o mesmo corpo repete a resposta guardada.
Maximum string length:
255Body
application/json
Body of POST /v2/public/upsells.
product_id is the product whose funnel the offer joins, which is what the source api meant by it (SHA 70cd772). It is not validated against the products table here: that table is Catalog's and this module may not query it. The write port checks the ownership and the controller answers 404, which also makes "not yours" and "does not exist" the same answer.
Maximum string length:
255Required range:
x >= 1Available options:
draft, published, null Required range:
x >= 1Maximum string length:
255Maximum string length:
255Maximum string length:
500Maximum string length:
500Response
ApiUpsellResource
Show child attributes
Show child attributes