POST api/hooks

This endpoint allows a client to specify a url to send data to in the event that an event of interest occurs. When these events occur, the url will receive a POST request with a JSON body of the element in question. These element will match the elements contained in a GET call to the Referral Rock Apis.

Request Information

URI Parameters

Query String:

None.

Body Parameters

A required structure used to initiate a subscription to an event.

Type: WebHookSubscription

NameDescriptionTypeAdditional information
target_url

The url to call back to when an event occurs.

string

None.

event

The event to subscribe to. The value can be, 'ProgramAdd', 'MemberAdd', 'MemberUpdate', 'MemberDelete', 'ReferralAdd', 'ReferralStatusChange', 'ReferralUpdate', 'ReferralDelete', 'RewardAdd', 'ReferralUpdate', 'RewardIssue', 'ReferralDelete', 'EmailUnsubscribed'

string

None.

Request Formats

application/json, text/json

Sample:
{
  "target_url": "sample string 1",
  "event": "sample string 2"
}

application/xml, text/xml

Sample:
<subscription xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <target_url>sample string 1</target_url>
  <event>sample string 2</event>
</subscription>

Response Information

Resource Description

[HTTP Status 201 - Created] A WebHookSubscriptionResult with the ID of the new subscription. This ID is needed to unsubscribe.

Type: WebHookSubscriptionResult

NameDescriptionTypeAdditional information
web_hook_id

The unique ID of the new subscription. This ID is needed to unsubscribe.

globally unique identifier

None.

Response Formats

application/json, text/json

Sample:
{
  "web_hook_id": "0205a4a3-51df-4a33-a989-af4acb47d4b8"
}

application/xml, text/xml

Sample:
<subscription xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <web_hook_id>0205a4a3-51df-4a33-a989-af4acb47d4b8</web_hook_id>
</subscription>