Add Activity API
This API allows the user to send event to the Netcore CE panel from external sources i.e. offline activity data
Details
URL Schema:
US IDC:
https://api2.netcoresmartech.com/v1/activity/upload
Indian IDC:
https://apiin2.netcoresmartech.com/v1/activity/upload
EU IDC:
https://apieu2.netcoresmartech.com/v1/activity/upload
Method:
POST
Authorization:
Bearer API_KEY
Header:
Key | Value |
---|---|
Content-Type | application/json |
Parameters:
Parameter | Description | Data Type | Required |
---|---|---|---|
activity_name | This is the name of the activity | String | Yes |
asset_id | Pass website_id or app_id for which the activity is mapped | String | Yes |
timestamp | This is the timestamp of the event that occurred. We currently support the UTC and ISO-8601 time zones. UTC Example Expected Value format: 2021-12-29T12:06:28Z In the UTC timezone, pass the timestamp. The timestamp will be displayed in the UI based on the timezone set on the panel. ISO-8601 Example In case, you would want to pass the timestamp in the local timezone, then refer to the below example for IST. Expected Value Format: 2021-12-29T06:12:28+05:30 | Date-Time | Yes |
annonid | This is the unique ID of the contact. This is mandatory if identity is not passed. This will be used in case of anon user. | String | No |
identity | This is the identifying information of the contact. It can be the email/mobile/customer-id of the logged-in contact. This is the same as the primary key in your Netcore CE Panel. Passing this parameter is mandatory for identified contacts. | String/Integer | Yes |
activity_source | This is a source of activity | String Depending on the asset that you are using whether it is a website or app, please use the source as either "web" or "app" For Website - use "web" For App - use "app" | Yes |
activity_params | This is activity payload data. | Object | Yes |
Product Array
Multiple products can be passed in API call in array format, which can be seen in the JSON example below.
However please note if you are passing the data in the format of an array and if it is blank, the system will not insert such events in the Netcore CE. Do Not Pass an Empty Array
Sample JSON:
[{
"asset_id": "sdbsjdh623jhmsndbkfs",
"activity_name":Purchase,
"timestamp":"2020-04-28T16:47:37",
"identity":CUSTOMER_ID,
"activity_source":"web",
"activity_params":
{
"customer_user_id": "xxxxxx",
"total_item_qty": 2,
"currency": "INR",
"items": [
{
"mrp": 250.1,
"l2_category": "Moisturizers",
"l3_category": "Serums & Essence",
"l1_category": "Skin",
"price": 250.3,
"quantity": 1,
"product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
},
{
"l1_category": "Makeup",
"quantity": 1,
"mrp": 620.3,
"product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
"price": 496.8
}
]
}
}]
Response: Success
{
"status": "success"
}
API Error Codes:
Error Code | Error |
---|---|
400 | Bad Request | Missing Parameter - Activity Name |
401 | Unauthorized | Invalid API Key |
405 | Method Not Allowed |
408 | Request Time Out |
500 | Internal Server Error |
Please Remember
If timestamp passed for event passed by the activity API is more than 24hrs old, it wont trigger a journey. It will be stored in the event data.
Using this API for bulk activity upload
The Same API described above can be used to upload activities in bulk(Max:1000) at a time.
Sample JSON:
[
{
"asset_id": "sdbsjdh623jhmsndbkfs",
"activity_name":"Purchase",
"timestamp":"2020-04-28T16:47:37",
"identity":"CUSTOMER_ID",
"activity_source":"web",
"activity_params": {
"customer_user_id": "xxxxxx",
"total_item_qty": 2,
"currency": "INR",
"items": [
{
"mrp": 250.0,
"l2_category": "Moisturizers",
"l3_category": "Serums & Essence",
"l1_category": "Skin",
"price": 250.0,
"quantity": 1,
"product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
},
{
"l1_category": "Makeup",
"quantity": 1,
"mrp": 620.20,
"product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
"price": 496.1
}
]}
},
{
"activity_name":"Checkout",
"timestamp":"2020-04-28T16:40:37Z",
"identity":"CUSTOMER_ID",
"activity_source":"web",
"activity_params": {
"customer_user_id": "xxxxxx",
"total_item_qty": "2",
"currency": "INR",
"items": [
{
"mrp": "250.0",
"l2_category": "Moisturizers",
"l3_category": "Serums & Essence",
"l1_category": "Skin",
"price": "250.0",
"quantity": "1",
"product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
},
{
"l1_category": "Makeup",
"quantity": "1",
"mrp": "620.0",
"product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
"price": "496.0"
}
]
},
{
"activity_name":"Add To Cart",
"timestamp":"2020-04-25T10:20:37Z",
"identity":"CUSTOMER_ID",
"activity_source":"web",
"activity_params": {
"customer_user_id": "xxxxxx",
"total_item_qty": "2",
"currency": "INR",
"items": [
{
"mrp": "250.0",
"l2_category": "Moisturizers",
"l3_category": "Serums & Essence",
"l1_category": "Skin",
"price": "250.0",
"quantity": "1",
"product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
},
{
"l1_category": "Makeup",
"quantity": "1",
"mrp": "620.0",
"product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
"price": "496.0"
}
]
}
]
The response and error codes are the same as defined above.
Updated about 1 month ago