curl --request PATCH \
--url https://api.speedsellx.io/v2/public/products/{id}/price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{
"price": 1
}'import requests
url = "https://api.speedsellx.io/v2/public/products/{id}/price"
payload = { "price": 1 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({price: 1})
};
fetch('https://api.speedsellx.io/v2/public/products/{id}/price', 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/products/{id}/price",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => 1
]),
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/products/{id}/price"
payload := strings.NewReader("{\n \"price\": 1\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.speedsellx.io/v2/public/products/{id}/price")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedsellx.io/v2/public/products/{id}/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"seller_id": 123,
"name": "<string>",
"description": "<string>",
"price": "<string>",
"currency": "<string>",
"type": "<string>",
"payment_type": "<string>",
"publish_status": "<string>",
"is_free": true,
"approved": true,
"sku": "<string>",
"recurrence_interval": "<string>",
"recurrence_interval_count": 123,
"trial_days": 123,
"category_id": 123,
"language_id": 123,
"image": "<string>",
"image_url": "<string>",
"delivery": "<string>",
"deliverable_content": "<string>",
"attachment_url": "<string>",
"landing_page": "<string>",
"support_email": "<string>",
"author": "<string>",
"warranty_time": 123,
"shipping_cost": "<string>",
"is_encapsulated": true,
"convert_currency": true,
"has_speed_recovery": true
}
}{
"status": "error",
"error": "unauthenticated"
}{
"status": "error",
"error": "insufficient_scope"
}{
"status": "error",
"error": "not_found"
}{
"status": "error",
"error": "idempotency_in_progress"
}{
"message": "<string>",
"errors": {}
}Alterar preço do produto
Define um novo valor, na moeda enviada ou na que o produto já carrega. Um produto de outra conta responde 404. Um produto sem moeda gravada, chamado sem currency, responde 422: a API não adivinha em que moeda o comprador será cobrado. Exige o escopo products:write e o header Idempotency-Key.
curl --request PATCH \
--url https://api.speedsellx.io/v2/public/products/{id}/price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{
"price": 1
}'import requests
url = "https://api.speedsellx.io/v2/public/products/{id}/price"
payload = { "price": 1 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({price: 1})
};
fetch('https://api.speedsellx.io/v2/public/products/{id}/price', 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/products/{id}/price",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'price' => 1
]),
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/products/{id}/price"
payload := strings.NewReader("{\n \"price\": 1\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.speedsellx.io/v2/public/products/{id}/price")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.speedsellx.io/v2/public/products/{id}/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"seller_id": 123,
"name": "<string>",
"description": "<string>",
"price": "<string>",
"currency": "<string>",
"type": "<string>",
"payment_type": "<string>",
"publish_status": "<string>",
"is_free": true,
"approved": true,
"sku": "<string>",
"recurrence_interval": "<string>",
"recurrence_interval_count": 123,
"trial_days": 123,
"category_id": 123,
"language_id": 123,
"image": "<string>",
"image_url": "<string>",
"delivery": "<string>",
"deliverable_content": "<string>",
"attachment_url": "<string>",
"landing_page": "<string>",
"support_email": "<string>",
"author": "<string>",
"warranty_time": 123,
"shipping_cost": "<string>",
"is_encapsulated": true,
"convert_currency": true,
"has_speed_recovery": true
}
}{
"status": "error",
"error": "unauthenticated"
}{
"status": "error",
"error": "insufficient_scope"
}{
"status": "error",
"error": "not_found"
}{
"status": "error",
"error": "idempotency_in_progress"
}{
"message": "<string>",
"errors": {}
}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.
255Path Parameters
Body
Body of PATCH /v2/public/products/{id}/price: a new amount, and optionally the currency to state it in.
The currency is optional because the source api made it optional (SHA 70cd772): a caller repricing in the currency the product already carries should not have to repeat it. The controller supplies the stored currency when this one is absent, which is why the Money is not built here.
Response
ApiProductResource
Show child attributes
Show child attributes