callback-registrations
Create a callback registration
Registers a synchronous callback for the company against a callback definition,
so Fluid can call the given url for decisions such as tax or shipping.
definition_name and url are required. Returns 201 with the created
registration; 422 when the body fails validation; 409 when a registration
for this definition already exists for the owner. Requires a company Bearer
token (401 otherwise).
POST
/
api
/
callback
/
registrations
Create a callback registration
curl --request POST \
--url https://api.fluid.app/api/callback/registrations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"callback_registration": {
"definition_name": "<string>",
"url": "<string>",
"active": true,
"country_codes": [
"<string>"
]
}
}
'import requests
url = "https://api.fluid.app/api/callback/registrations"
payload = { "callback_registration": {
"definition_name": "<string>",
"url": "<string>",
"active": True,
"country_codes": ["<string>"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
callback_registration: {
definition_name: '<string>',
url: '<string>',
active: true,
country_codes: ['<string>']
}
})
};
fetch('https://api.fluid.app/api/callback/registrations', 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.fluid.app/api/callback/registrations",
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([
'callback_registration' => [
'definition_name' => '<string>',
'url' => '<string>',
'active' => true,
'country_codes' => [
'<string>'
]
]
]),
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.fluid.app/api/callback/registrations"
payload := strings.NewReader("{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\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.fluid.app/api/callback/registrations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/callback/registrations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"callback_registration": {
"uuid": "<string>",
"company_id": 123,
"company_name": "<string>",
"definition_name": "<string>",
"url": "<string>",
"verification_token": "<string>",
"active": true,
"country_codes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"owner_type": "<string>",
"owner_id": 123,
"owner_name": "<string>"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}⌘I
Create a callback registration
curl --request POST \
--url https://api.fluid.app/api/callback/registrations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"callback_registration": {
"definition_name": "<string>",
"url": "<string>",
"active": true,
"country_codes": [
"<string>"
]
}
}
'import requests
url = "https://api.fluid.app/api/callback/registrations"
payload = { "callback_registration": {
"definition_name": "<string>",
"url": "<string>",
"active": True,
"country_codes": ["<string>"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
callback_registration: {
definition_name: '<string>',
url: '<string>',
active: true,
country_codes: ['<string>']
}
})
};
fetch('https://api.fluid.app/api/callback/registrations', 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.fluid.app/api/callback/registrations",
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([
'callback_registration' => [
'definition_name' => '<string>',
'url' => '<string>',
'active' => true,
'country_codes' => [
'<string>'
]
]
]),
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.fluid.app/api/callback/registrations"
payload := strings.NewReader("{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\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.fluid.app/api/callback/registrations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/callback/registrations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"callback_registration\": {\n \"definition_name\": \"<string>\",\n \"url\": \"<string>\",\n \"active\": true,\n \"country_codes\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"callback_registration": {
"uuid": "<string>",
"company_id": 123,
"company_name": "<string>",
"definition_name": "<string>",
"url": "<string>",
"verification_token": "<string>",
"active": true,
"country_codes": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"owner_type": "<string>",
"owner_id": 123,
"owner_name": "<string>"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}