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
Validate API will enable you to validate a referral code entered by customer on your application.
API details
API Endpoint: https://api.rehook.ai/customers/validate-code/{referral_code}
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/KMN
KMN is the referral code entered by the customer in above URL path.
response
If entered referral code is valid, then rehook will return the referral code 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 |
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 entered referral code is invalid.
{
"code": 404,
"message": "resource not found",
"details": "invalid refferal code",
"request_id": "c7af110a-5bdc-9e44-96d5-ad3eba3e086d"
}