Validate Referral Code
This API endpoint validates a referral code that a customer has entered.
Method
GET
URL Path
/api/customers/validate-code/{referral_code}
Parameters
Name | In | Type | Description | Required |
---|---|---|---|---|
referral_code | path | string | Referral Code | true |
Responses
200 OK
The referral code was successfully validated.
- Type: object
- Schema: models.CustomerResponse
404 Not Found
The referral code was not found or is invalid.
- Type: object
- Schema: models.ErrorResponse
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 customer API will enable you retrieve the details of your customer at applicable touch points of your application to show it on your application UI.
API details
API Endpoint: https://api.rehook.ai/customers/{source_id}
HTTP Method: POST
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/validate-code/krishna123
krishna123 is the customer Id of your application in above URL path
response
If entered source id is valid, then rehook will return the customer details in the response body.
{
"id": "cust_SbwItbqREfhaj2UWdc42X",
"source_id": "krishna123",
"metadata": {
"location": "HSR layout",
"referral.count": 5,
"referral_code": "KBLGPN"
},
"created_at": "2023-09-13T09:45:59.663295Z",
"updated_at": "2023-09-13T09:45:59.663295Z",
"message_text": "NA",
"messaging_image_url": "NA",
"request_id": "f9de4704-1e75-9b61-92f1-440cd81ffb04"
}
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 |
created_at | date on which referral code is assigned |
updated_at | date on which referral code is updated |
message_text | text message attached to a referral campaign. |
messaging_image_url | image URL attached to the referral campaign message |
request_id | API request id assigned by rehook |
location | user property. if there are any other user properties attached to a user, then all such properties and it's value is returned in meta data object |
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 source id is invalid.
{
"code": 404,
"message": "resource not found",
"details": "cannot find record with given id",
"request_id": "79102cbb-826c-94f8-9392-8c2780edd19b"
}