Samples
This page provides sample webhook requests, responses, and other helpful information.
Authentication request and response sample
Your authentication endpoint must accept the credentials sent from Spotnana and respond with a JSON payload containing the access token, its expiration interval, and the token type (e.g., Bearer).
Let’s assume that the partner’s authentication endpoint is https://partner.com/api/v1/auth
. The request and response would need to adhere to the format shown in the sample below:
Request sample
POST https://partner.com/api/v1/auth
curl --location 'https://partner.com/api/v1/auth' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id=123456' \ --data-urlencode 'client_secret=super-secret-password' \ --data-urlencode 'grant_type=client_credentials'
Note: The authentication request uses the
x-www-form-urlencoded
format.
Response sample
200 OK
{ "access_token":"dadada-123", "expires_in":3600, "token_type":"Bearer" }
Webhook delivery sample
Your delivery endpoint must authenticate using the token_type
specified in the authentication response. The endpoint must accept the webhook payload sent via POST
requests in JSON format containing the event data. The HTTP status code of the endpoint response will determine if the message has been successfully delivered to your endpoint.
Notes:
- We currently do not process the response payload for any information other than the HTTP status code.
- A
200 OK
response will be logged as a successful webhook delivery. Any other status code returned by your endpoint will be logged as a failed webhook delivery and our system will initiate retry attempts.
Let’s assume that the partner’s delivery endpoint is https://partner.com/api/v1/travel-delivery
. Here's an example of the event request and response:
Request sample
POST https://partnr.ecom/api/v1/travel-delivery
{ "event_type": "PNR_APPROVAL", "payload": { "pnrId": "string", "tripId": "string", "approvalId": "string", "appliedApprovalType": "SOFT_APPROVAL", "deadline": { }, "approvers": [ ] }, "operation_summary": { "ticket_issued": [], "tickets_refunded": [], "tickets_voided": [] }, "operation": "BOOKING_CREATED", "timestamp": "2023-02-08T21:28:30.713546-08:00" }
Note: Visit the webhook events section to view the list of all webhooks supported by Spotnana and their respective
payload
data.
Response sample
200 OK
{ "success":"true" }
Note: It is recommended to return the response in JSON format so that the webhook delivery status is logged correctly in the Spotnana platform.
Sample webhook receiver
Use this sample receiver (powered by Node.js) as a reference to create your own endpoint to receive the webhook messages from Spotnana.