Fez Business API
  • Introduction
  • API ENDPOINTS
    • Auth
      • Authenticate
      • Logout
      • Change Password
    • Orders
      • Create
      • Get
      • Update
      • Delete
      • Search
      • Search via Waybill Number
      • Status With Date Range
      • Fetch Delivery Cost
      • Track
      • Delivery Time Estimate
    • International Orders
      • Create Import Order
      • Import Items Categories
      • Import Locations
      • Import Delivery Cost
      • Export Locations
      • Create Export Order
      • Export Delivery Cost
    • Users
      • Create
      • Get All
      • Delete
    • Locker
      • Get All
      • Check Availability
    • Webhook
      • Register Order Webhook
      • Order Webhook Request
Powered by GitBook
On this page
  1. API ENDPOINTS
  2. Webhook

Register Order Webhook

This endpoint stores client webhook (url) for to be called when an Order is created or altered. A successful response includes the order number and the status of the order.

Note that the registered url should be a POST route. Json body will be sent to this route and will contain orderNumber and orderStatus as request body.

Register.

POST /webhooks/store

Headers

Name
Type
Description

secret-key*

user secret key

Authorization*

Token

{
    "status": "Success",
    "description": "Request successful",
    "data": {
        "webhook": "https://example.com",
        "webhooks": [
            {
                "url": "https://example.com",
                "type": "App\\Models\\Order",
                "is_active": 1
            }
        ]
    }
}
{
    "status": "Error",
    "description": "Organization Secret Key is Required"
}
{
    "status": "Error",
    "description": "The webhook field is required."
}
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apisandbox.fezdelivery.co/v1/webhooks/store',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "webhook":"https://example.com",
}',
  CURLOPT_HTTPHEADER => array(
    'secret-key: {{Your Secret Key}}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
PreviousWebhookNextOrder Webhook Request

Last updated 8 months ago