Callback Example
curl --request POST \
--url https://api.petstoreapi.com/v1/orders/{id} \
--header 'Content-Type: application/json' \
--data '
{
"amount": "738.05",
"currency": "USD",
"timestamp": "1758613403",
"callbackUrl": "https://example.com/callbacks/orders/1312312"
}
'import requests
url = "https://api.petstoreapi.com/v1/orders/{id}"
payload = {
"amount": "738.05",
"currency": "USD",
"timestamp": "1758613403",
"callbackUrl": "https://example.com/callbacks/orders/1312312"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '738.05',
currency: 'USD',
timestamp: '1758613403',
callbackUrl: 'https://example.com/callbacks/orders/1312312'
})
};
fetch('https://api.petstoreapi.com/v1/orders/{id}', 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.petstoreapi.com/v1/orders/{id}",
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([
'amount' => '738.05',
'currency' => 'USD',
'timestamp' => '1758613403',
'callbackUrl' => 'https://example.com/callbacks/orders/1312312'
]),
CURLOPT_HTTPHEADER => [
"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.petstoreapi.com/v1/orders/{id}"
payload := strings.NewReader("{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.petstoreapi.com/v1/orders/{id}")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.petstoreapi.com/v1/orders/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/not-found",
"title": "Not Found",
"status": 404,
"detail": "The requested pet with ID '123' was not found.",
"instance": "/pets/123"
}Store
Callback Example
Handles order events and supports asynchronous processing with Callback.
POST
/
orders
/
{id}
Callback Example
curl --request POST \
--url https://api.petstoreapi.com/v1/orders/{id} \
--header 'Content-Type: application/json' \
--data '
{
"amount": "738.05",
"currency": "USD",
"timestamp": "1758613403",
"callbackUrl": "https://example.com/callbacks/orders/1312312"
}
'import requests
url = "https://api.petstoreapi.com/v1/orders/{id}"
payload = {
"amount": "738.05",
"currency": "USD",
"timestamp": "1758613403",
"callbackUrl": "https://example.com/callbacks/orders/1312312"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '738.05',
currency: 'USD',
timestamp: '1758613403',
callbackUrl: 'https://example.com/callbacks/orders/1312312'
})
};
fetch('https://api.petstoreapi.com/v1/orders/{id}', 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.petstoreapi.com/v1/orders/{id}",
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([
'amount' => '738.05',
'currency' => 'USD',
'timestamp' => '1758613403',
'callbackUrl' => 'https://example.com/callbacks/orders/1312312'
]),
CURLOPT_HTTPHEADER => [
"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.petstoreapi.com/v1/orders/{id}"
payload := strings.NewReader("{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.petstoreapi.com/v1/orders/{id}")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.petstoreapi.com/v1/orders/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"738.05\",\n \"currency\": \"USD\",\n \"timestamp\": \"1758613403\",\n \"callbackUrl\": \"https://example.com/callbacks/orders/1312312\"\n}"
response = http.request(request)
puts response.read_body{}{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/not-found",
"title": "Not Found",
"status": 404,
"detail": "The requested pet with ID '123' was not found.",
"instance": "/pets/123"
}Headers
Optional tenant identifier for data isolation. When provided, all operations will be scoped to this tenant, ensuring data separation between different organizations or users. If omitted, operations will access the shared/public data pool where data may be visible to and modified by other users.
Path Parameters
Unique identifier for the order
Body
application/json
Response
Callback enqueued successfully.
The response is of type object.
⌘I