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
| Name | Description | Type | Additional 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
{
"target_url": "sample string 1",
"event": "sample string 2"
}
application/xml, text/xml
<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
| Name | Description | Type | Additional 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
{
"web_hook_id": "fa984167-f6d4-4b4e-afb1-33c80289e32f"
}
application/xml, text/xml
<subscription xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <web_hook_id>fa984167-f6d4-4b4e-afb1-33c80289e32f</web_hook_id> </subscription>