This api returns metadata corresponding to user, campaign_id and campaign_type

Introduction

Get metadata API returns metadata objects corresponding to a user, campaign and campaign_type. you can call this API at applicable touch points on your application to create customised UI page for a campaign using metadata configured in rehook.

API details

API Endpoint: https://api.rehook.ai/campaigns/meta-data

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 setting, 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 key of your application in every new request as Authorization. Rehook use Basic authentication method to authenticate the API calls.

AuthorizationValue
UsernameAPI key of your application
PasswordSecret key of your application

Parameters

Query Parameters

You have to provide following query parameters

ParameterDefinitionvalue
source_idoptional
Rehook id or source id of your customer
KMN@123
campaign_idoptional
campaign_id assigned by rehook for a campaign created on rehook dashboard (default: empty)
abc133nan
campaign_typeoptional
type of campaign name (default:empty)
Loyalty/Leaderboard/Referral/Distribution

Body Parameters

This API doesn't requires any body parameters.

Sample request and response

URL = https://api.rehook.ai/campaigns/meta-data

query parameters: empty

complete response

[
  {
    "campaign_id": "camp_EOurRUrHEDfTH5oo00pMp",
    "campaign_type": "leaderboard",
    "id": "",
    "campaign_status": "active"
  },
  {
    "campaign_id": "camp_8w7wPVVB2v0EK4PTCkrk5",
    "campaign_type": "camp_8w7wPVVB2v0EK4PTCkrk5",
    "id": "",
    "campaign_status": "active",
    "metadata": {
      "referral_banner_page": "image URL",
      "referal_ui_description": "refer a freiend and get 30 coins"
    }
    ]

Definition of response body

Response body is an array of objects. each array has campaign details with it's respective metadata. you have to consume the meta data object within a campaign array.

FieldDefinitionvalue
campaign_idcampaign_id assigned by rehook for a campaign created on rehook dashboardcamp_8w7wPVVB2v0EK4PTCkrk5
campaign_typetype of campaign name (default:empty)loyalty/leaderboard/referral/distribution
id
campaign_statuscurrent status of the campaignActive/Paused

metadata object

meta data key namemeta data value
key 1value 1
key 2value 2

Example:

meta data key namemeta data value
referral_banner_pageimage URL
referral_ui_descriptionrefer a friend and get 30 coins

API Behaviour

Below table shows the expected response for different cases

caserequestexpected response
Get all campaign detailsConsume API without passing any query parameterRehook returns all the active campaign details with it's metadata. (please note, metadata will be returned only if that campaign has metadata configured)
Get campaign details and metadata for specific source_idPass source_id in the query parameterRehook returns campaign details and metadata applicable for a given source_id
Get campaign details and meta data for specific campaignPass campaign_id and campaign type in the query parameterRehook returns campaign details and it's metadata for a given campaign id or campaign type.

📘

Note

  1. campaign_id is available on rehook dashboard against each campaign. you have to manually get this id from rehook dashboard only and map the same id at your end.
  2. campaign type have following standard values - loyalty, referral, distribution, leaderboard
  3. Don't pass any query parameters if you want to fetch all the campaign details

Success Response:

If API call is successful, then Rehook will return the following HTTP success code with response body as given above.

HTTP CodeMessage
200Ok

Error Responses

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 coupon code is wrong
messageerror messagecoupon_code not found
request_idAPI request Id assigned by Rehookabc_123

Following are possible list of cases with error messages

1. when source_id is wrong

reutrns all the campaigns details

2. when campaign_id or campaign type is wrong

[] empty response
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!