Subscribe to webhooks - Fabric
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Subscribe to webhooks
cURL
curl --request POST \
--url https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": 11011,
"url": "https://webhook.example.com/notify",
"event": "order.created",
"is_active": true
}
'```
#### Python
import requests
url = "https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/"
payload = {
"id": 11011,
"url": "https://webhook.example.com/notify",
"event": "order.created",
"is_active": True
}
headers = {
"Authorization": "Bearer
response = requests.post(url, json=payload, headers=headers)
print(response.text)
#### JavaScript (Fetch)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer
fetch('https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
#### PHP
"https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/",
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([
'id' => 11011,
'url' => 'https://webhook.example.com/notify',
'event' => 'order.created',
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer
#### Go
package main
import ( "fmt" "strings" "net/http" "io" )
func main() {
url := "https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/"
payload := strings.NewReader("{\n "id": 11011,\n "url": "https://webhook.example.com/notify\",\n "event": "order.created",\n "is_active": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(string(body)) }
#### Unirest (Java)
HttpResponse
#### Ruby
require 'uri' require 'net/http'
url = URI("https://marketplace-api.fabric.inc/v1/retailers/{retailer_id}/webhooks/")
http = Net::HTTP.new(url.host, url.port) http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer
response = http.request(request) puts response.read_body
### Response
**201 - application/json**
Webhook subscription created
Webhook subscription payload
#### Example Response Object
{ "id": 11011, "url": "https://webhook.example.com/notify", "event": "order.created", "is_active": true }
### Authorizations
Authorization:
string
header
required
Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.
### Path Parameters
**retailer_id**
integer
required
The unique retailer ID. In the Dropship UI this is called the Merchant ID. To find your Merchant ID, click your merchant name in the top nav.
Example:
`1001`
### Body
**application/json**
Webhook subscription payload
**- id**
integer
Unique identifier for the subscription
Example:
`11011`
**- url**
string<uri>
Webhook listener endpoint
Example:
`"https://webhook.example.com/notify"`
**- event**
string
The event to subscribe to (e.g., order.created)
Example:
`"order.created"`
**- is_active**
boolean
Whether the subscription is currently active
Example:
`true`
### Response Attributes
**id**
integer
Unique identifier for the subscription
Example:
`11011`
**url**
string<uri>
Webhook listener endpoint
Example:
`"https://webhook.example.com/notify"`
**event**
string
The event to subscribe to (e.g., order.created)
Example:
`"order.created"`
**is_active**
boolean
Whether the subscription is currently active
Example:
`true`