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

NameInTypeDescriptionRequired
referral_codepathstringReferral Codetrue

Responses

200 OK

The referral code was successfully validated.

404 Not Found

The referral code was not found or is invalid.

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

  1. API Key and Secret Key for your application
  2. 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
  3. 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.

AuthorizationValue
UsernameAPI Key of your application
PasswordSecrete 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

ParameterInDefinitionexample
source_idPathrequired
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 nameDefinition
idRehook Id of customer
source_idsource id of customer on your application
referral.countNumber of successful referrals done by advocate
referral_codereferral code
created_atdate on which referral code is assigned
updated_atdate on which referral code is updated
message_texttext message attached to a referral campaign.
messaging_image_urlimage URL attached to the referral campaign message
request_idAPI 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 CodeMessage
400bad request

error response body

field namedescriptionexample
CodeError code400
detailsError detailsGiven resource Id is wrong
messageerror messageResource Id not found
request_idAPI request Id assigned by Rehookabc_123

Sample error response

  1. When entered referral code is invalid.
{
    "code": 404,
    "message": "resource not found",
    "details": "invalid refferal code",
    "request_id": "c7af110a-5bdc-9e44-96d5-ad3eba3e086d"
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!