API Reference

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

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

  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/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 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
locationuser 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 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 source id is invalid.
{
    "code": 404,
    "message": "resource not found",
    "details": "cannot find record with given id",
    "request_id": "79102cbb-826c-94f8-9392-8c2780edd19b"
}
Language
Credentials
Basic
base64
:
Click Try It! to start a request and see the response here!