Get all Referrals for a Customer
This API endpoint retrieves a list of all successful referrals for a customer based on their Rehook ID or Source ID.
Method
GET
URL Path
/api/customers/referrals/{source_id}
Parameters
Name | In | Type | Description | Required |
---|---|---|---|---|
source_id | path | string | Rehook ID / Source ID of the customer | true |
Responses
200 OK
The request was successful, and a list of successful referrals is returned.
- Type: array
- Items: models.CustomerResponse
404 Not Found
The requested customer or referrals were not found.
- Type: object
- Schema: models.ErrorResponse
Use Cases
- Fetching a list of successful referrals to analyze customer engagement.
- Displaying referral information in a user dashboard.
Rehook Platform API provides resource oriented URLs to work with your business data. Our API uses JSON for request and response. API errors are returned using standard HTTP response codes.
Introduction
Get all referrals API will enable you to retrieve all the successful referrals for a given customer based on their Rehook Id or source id.
Retrieved details can be used to support the following use cases:
- Fetching a list of successful referrals to analyse customer engagement.
- Displaying referral information on a user dashboard of your application.
API details
API Endpoint: https://api.rehook.ai/customers/referral/list/{source_id}
HTTP Method: GET
Prerequisites
- API Key and Secret Key for your application
- If you don't know the API key and secret key, please go to setting module on admin panel to view API details for your application. To know more about application settings, please visit Application setting
- API key and secret key are auto generated and cannot be changed.
Authentication
You need to provide the API key and Secret of your application in every new request as Authorisation. Rehook use Basic authentication method to authenticate the API calls.
Authorization | Value |
---|---|
Username | API Key of your application |
Password | Secrete key of your application |
Parameters
This API doesn't requires any query or body parameters. you have to provide the source_id as parameter in the path URL
Parameter | In | Definition | example |
---|---|---|---|
source_id | Path | required Rehook Id or source id of customer | KMN@123 |
Sample request and response
Path: https://api.rehook.ai/customers/referral/list/krishna123
krishna123 is the source id of customer in above URL path
response
If given source id is valid, then rehook will return the referral code details of given customer in the response body.
[
{
"id": "cust_jgi46J4s9ypiOBzCfvDxY",
"source_id": "New_customer6",
"metadata": {
"age": 27,
"email": "New_customer6",
"gender": "male",
"name": "New_customer6",
"referral.count": 0
},
"referral_code": "KI2BUN",
"created_at": "2023-09-20T10:36:55.712166Z",
"updated_at": "2023-09-20T10:36:55.712166Z"
}
]
Below table shows the definition of response body
Field name | Definition |
---|---|
id | Rehook Id of customer |
source_id | source id of customer on your application |
referral.count | Number of successful referrals done by advocate |
referral_code | referral code of customer |
created_at | date on which referral code is assigned |
updated_at | date on which referral code is updated |
metadata object | Meta object has user properties details |
Error cases
If API call is failed, then Rehook will return the following HTTP success code with response body as given below:
HTTP Code | Message |
---|---|
400 | bad request |
error response body
field name | description | example |
---|---|---|
Code | Error code | 400 |
details | Error details | Given resource Id is wrong |
message | error message | Resource Id not found |
request_id | API request Id assigned by Rehook | abc_123 |
Sample error response
- when given source id is wrong
{
"code": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find customer with source id %7BKMN@123%7D",
"request_id": "76671c8b-a156-91f6-8757-dca7d6d08846"
}