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
- 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 setting, 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 key of your application in every new request as Authorization. Rehook use Basic authentication method to authenticate the API calls.
Authorization | Value |
---|---|
Username | API key of your application |
Password | Secret key of your application |
Parameters
Query Parameters
You have to provide following query parameters
Parameter | Definition | value |
---|---|---|
source_id | optional Rehook id or source id of your customer | KMN@123 |
campaign_id | optional campaign_id assigned by rehook for a campaign created on rehook dashboard (default: empty) | abc133nan |
campaign_type | optional 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.
Field | Definition | value |
---|---|---|
campaign_id | campaign_id assigned by rehook for a campaign created on rehook dashboard | camp_8w7wPVVB2v0EK4PTCkrk5 |
campaign_type | type of campaign name (default:empty) | loyalty/leaderboard/referral/distribution |
id | ||
campaign_status | current status of the campaign | Active/Paused |
metadata object
meta data key name | meta data value |
---|---|
key 1 | value 1 |
key 2 | value 2 |
Example:
meta data key name | meta data value |
---|---|
referral_banner_page | image URL |
referral_ui_description | refer a friend and get 30 coins |
API Behaviour
Below table shows the expected response for different cases
case | request | expected response |
---|---|---|
Get all campaign details | Consume API without passing any query parameter | Rehook 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_id | Pass source_id in the query parameter | Rehook returns campaign details and metadata applicable for a given source_id |
Get campaign details and meta data for specific campaign | Pass campaign_id and campaign type in the query parameter | Rehook returns campaign details and it's metadata for a given campaign id or campaign type. |
Note
- 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.
- campaign type have following standard values - loyalty, referral, distribution, leaderboard
- 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 Code | Message |
---|---|
200 | Ok |
Error Responses
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 coupon code is wrong |
message | error message | coupon_code not found |
request_id | API request Id assigned by Rehook | abc_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