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

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'

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": "cc9fed17-e6a3-4ee0-98d0-295e6d6c90dd"
}

application/xml, text/xml

Sample:
<subscription xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <web_hook_id>cc9fed17-e6a3-4ee0-98d0-295e6d6c90dd</web_hook_id>
</subscription>