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

NameInTypeDescriptionRequired
source_idpathstringRehook ID / Source ID of the customertrue

Responses

200 OK

The request was successful, and a list of successful referrals is returned.

404 Not Found

The requested customer or referrals were not found.

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:

  1. Fetching a list of successful referrals to analyse customer engagement.
  2. 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

  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/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 nameDefinition
idRehook Id of customer
source_idsource id of customer on your application
referral.countNumber of successful referrals done by advocate
referral_codereferral code of customer
created_atdate on which referral code is assigned
updated_atdate on which referral code is updated
metadata objectMeta 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 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 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"
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!