Action API
This is the main API to create Action(s).
Referred User Object
- Name
id
- Type
- int
- Description
The unique Referred User Object id.
- Name
created_at
- Type
- string
- Description
Date of creation of Referred User, in the format "Year-Month-Day_Hour-Minute-Seconds".
- Name
referral_link
- Type
- JSON
- Description
Referral Link Object of the referral link the referred user is associated with.
- Name
referred_user_id
- Type
- string
- Description
ID of the user referred through a referral link.
Action Object Example
{
"id": 1,
"created_at": "2023-09-10_04-33-06",
"referral_link": {
"id": 1,
"created_at": "2023-09-10_03-33-06",
"referral_code": "ABC623KC",
"campaign_id": "3a6a4dd0-1055-4c3c-a531-7036793e10ee",
"referrer_id": "referrer@gmail.com",
"total_clicks" : 2,
"total_referrals": 1,
"referral_link": "https://example.com?rfa=ABC623KC"
},
"referred_user": "user@gmail.com"
}
Action Object
- Name
id
- Type
- int
- Description
The unique Action id.
- Name
created_at
- Type
- string
- Description
Date of creation of Action, in the format "Year-Month-Day_Hour-Minute-Seconds".
- Name
action_type
- Type
- string
- Description
Descriptive name assigned to the action.
- Name
metadata
- Type
- JSON
- Description
Metadata associated with the action.
- Name
referreral_link
- Type
- JSON
- Description
Referral Link Object of the referral link the action is associated with.
- Name
referred_user
- Type
- JSON or None
- Description
Referred User Object in case action is associated with a referred user, otherwise null. The "Referred User Object" referral link and "Action Object" referral link would point to same referral link.
Action Object Example
{
"id": 1,
"created_at": "2023-09-11_03-33-06",
"action_type": "PURCHASED_PRODUCT"
"metadata": {"productId" : "PROD12A"},
"referral_link": {
"id": 1,
"created_at": "2023-09-10_03-33-06",
"referral_code": "ABC623KC",
"campaign_id": "3a6a4dd0-1055-4c3c-a531-7036793e10ee",
"referrer_id": "referrer@gmail.com",
"total_clicks" : 4,
"total_referrals": 1,
"referral_link": "https://example.com?rfa=ABC623KC"
},
"referred_user": {
"id": 1,
"created_at": "2023-09-10_04-33-06",
"referral_link": {
"id": 1,
"created_at": "2023-09-10_03-33-06",
"referral_code": "ABC623KC",
"campaign_id": "3a6a4dd0-1055-4c3c-a531-7036793e10ee",
"referrer_id": "referrer@gmail.com",
"total_clicks" : 4,
"total_referrals": 1,
"referral_link": "https://example.com?rfa=ABC623KC"
},
"referred_user": "user@gmail.com"
}
}
Create an Action - Linked to Referred User
Required attributes
- Name
campaign_id
- Type
- string
- Description
The Action you create has to be associated with a campaign. Use the UUID from your Campaign creation API or from your dashboard.
- Name
action_type
- Type
- string
- Description
Any descriptive name you wish to assign to this action.
- Name
referred_user_id
- Type
- string
- Description
The id of the user you wish to link the action to. It is the same id that you used to create the Referred user.
Optional attributes
- Name
metadata
- Type
- JSON
- Description
Any metadata that you wish to associate with action.
Response
The response is an Action object as shown in the response. The Action Object is created if the provided referred_user_id
exists for the given campaign.
Request
curl --request POST \
--url https://api.referralapi.com/api/v1/action/referred_user \
--header 'Content-Type: application/json' \
--header 'api-key: 1968aa57ccd72d208dbac95d6679e6389ecfd60e59f31163506474a9c766fb6d' \
--data '{
"campaign_id": "3a6a4dd0-1055-4c3c-a531-7036793e10ee",
"referred_user_id": "user@gmail.com",
"action_type": "PURCHASED_PRODUCT"
}'
Create Action Response Example
{
"id": 1,
"created_at": "2023-09-11_03-33-06",
"action_type": "PURCHASED_PRODUCT"
"metadata": {},
"referral_link": {
"id": 1,
"created_at": "2023-09-10_03-33-06",
"referral_code": "ABC623KC",
"campaign_id": "3a6a4dd0-1055-4c3c-a531-7036793e10ee",
"referrer_id": "referrer@gmail.com",
"total_clicks" : 4,
"total_referrals": 1,
"referral_link": "https://example.com?rfa=ABC623KC"
},
"referred_user": "user@gmail.com"
}