Comment on page
Rest API User & Device
Push API allows you to manage device registration and notifications. By sending HTTP request you can register, tag, change profile attribute of user/devices. You can also send notification and get the details of sent notification via REST API.
Maximum 1000 Unique External IDs in a Single REST API Request:
When making a request, you can include up to 1000 unique external IDs for processing. This limitation is in place to ensure the efficiency and proper handling of requests. If you need to include more than 1000 different external IDs, you would need to split them across multiple requests. This helps maintain the performance and reliability of the API.
Following request can be used to register multiple devices at the same time. Instead of registering single device, you can post array of devices for bulk registration. This method will help you to import your devices into Netmera easily.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"deviceToken" : "9E9FFE12A458D89BF61F3451FD62609F0D2459B9994F692DDBFDDC0EE03C6724",
"platform" : "IOS",
"extId" : "id_in_my_system_1"
},
{
"deviceToken" : "dPwJh-BYs3M:APA91bFsI7ZXqPhVur--u_ggbxZlAHmTyfktDeyXNcFh27J_cnQU0in3X4AqlXa0Eka9KTWz5RcANuq4pLmUK1s8pv3m5fXpAbEhGWOhQjsyqe8cLyZTLVojt0WQMUaGZvMg83nLVVfh",
"platform" : "ANDROID",
"extId" : "id_in_my_system_2",
"email" : "[email protected]"
}
]' \
https://restapi.netmera.com/rest/3.0/registerUsers
deviceToken: Push token value to use to send push. It's generated by push service provider (GCM, APNS).
platform: Platform of device.
extId (Optional): User ID in your application to associate with device. It's useful for you know to know which device belongs to who.
email (Optional): E-mail of user. Send e-mail info if you want to find/export users by email.
This request serves to completely delete all information about users from Netmera.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d
--data-raw '{
"extIds" : [
"test1234"
]
}' \
https://restapi.netmera.com/rest/3.0/deleteUsersPermanently
In order to benefit from this service, it is necessary to submit an offer from the panel. You can contact the success manager for the offer.⚠
Following request can be used to opt-out the devices of a user or a single device from push notifications. If you opt-out a user using extId, all of the devices of that user will be opted-out from push notifications. You can opt-out a single device using
deviceToken
.curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"extId" : "id_in_my_system_1"
}' \
https://restapi.netmera.com/rest/3.0/disablePush
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"deviceToken" : "my_device_token"
}' \
https://restapi.netmera.com/rest/3.0/disablePush
Following request can be used to opt-in the devices of a user or a single device from push notifications. If you opt-in a user using extId, all of the devices of that user will be opted-in from push notifications. You can opt-in a single device using
deviceToken
.curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"extId" : "id_in_my_system_1"
}' \
https://restapi.netmera.com/rest/3.0/enablePush
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"deviceToken" : "my_device_token"
}' \
https://restapi.netmera.com/rest/3.0/enablePush
The following request is used to tag a user.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"tag" : "Sport",
"extIds" : ["id_in_my_system_1", "id_in_my_system_2"]
}' \
https://restapi.netmera.com/rest/3.0/tagUsers
extIds (Required): Array of external ids of users to tag. External ids comes from your system.
tag (Required): Name of the tag.
The following request is used to remove a tag from given users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '{
"tag" : "Sport",
"extIds" : ["id_in_my_system_1", "id_in_my_system_2"]
}' \
https://restapi.netmera.com/rest/3.0/untagUsers
Parameters
extIds (Required) : Array of external ids of users to tag. External ids comes from your system.
tag (Required) : Name of the tag.
You can set opt-in/opt-out preference for each category previously defined in Netmera panel. If any message with a category sent, opt-out users will be excluded.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"extId" : "id_in_my_system_1",
"category" : "Shopping",
"enable" : true
},
{
"extId" : "id_in_my_system_1",
"category" : "Promotion",
"enable" : false
}
]' \
https://restapi.netmera.com/rest/3.0/setCategoryPreferences
extId (Required): External id of a user. External id comes from your system.
category (Required): Name of the category which is defined in Netmera panel.
enable (Required): Preference of category opt-in/out.
The following request is used to set profile attributes of given users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"extId" : "id_in_my_system_1",
"profile" : {
"age" : 24
}
},
{
"extId" : "id_in_my_system_2",
"profile" : {
"name" : "John"
}
}
]' \
https://restapi.netmera.com/rest/3.0/setProfileAttributes
extId (Required): External id of user to set profile attribute.
profile (Required): New profile attributes. Note that previously existing profile attributes with different keys will remain same whereas profile attributes with given keys will be overwritten.
The following request is used to unset profile attributes of given users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"extId" : "id_in_my_system_1",
"profile" : ["age"]
},
{
"extId" : "id_in_my_system_2",
"profile" : ["age", "name"]
}
]' \
https://restapi.netmera.com/rest/3.0/unsetProfileAttributes
extId (Required): External id of user to remove profile attribute.
profile (Required): Profile attribute keys to unset.
The following request is used to delete given profile attributes of all users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"profile" : ["name", "age"]
}
]' \
https://restapi.netmera.com/rest/3.0/deleteProfileAttributes
profile (Required): Profile attribute keys to delete.
The following request is used get all profile attributes associated with given user.
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
-G \
--data-urlencode extId=id_in_my_system \
'https://restapi.netmera.com/rest/3.0/getProfileAttributes'
Parameters
extId (Required): External id of user to get profile attributes.
Sample response:
{
"extId": "id_in_my_system",
"profile": {
"surname": "Brown",
"name": "John",
"dateOfBirth": 624315600000
}
}
The following request is used to push profile attributes of given users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"extId" : "id_in_my_system_1",
"profile" : {
"lastVisitedCategories" : ["shopping","promotion"]
}
},
{
"extId" : "id_in_my_system_2",
"profile" : {
"lastVisitedProducts" : ["blouse","skirt"]
}
}
]' \
https://restapi.netmera.com/rest/3.0/pushProfileAttributes
Parameters
extId (Required): External id of user to push values to profile attributes.
profile (Required): Profile attributes to push values. Note that given profile attribute must be an array.
The following request is used to pull profile attributes of given users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"extId" : "id_in_my_system_1",
"profile" : {
"lastVisitedCategories" : ["promotion"]
}
},
{
"extId" : "id_in_my_system_2",
"profile" : {
"lastVisitedProducts" : ["skirt"]
}
}
]' \
https://restapi.netmera.com/rest/3.0/pullProfileAttributes
Parameters
extId (Required): External id of user to pull values from profile attributes.
profile (Required): Profile attributes to pull values. Note that given profile attribute must be an array.
The following request is used to delete all profile attributes with a specific value from all users.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json" \
-d '[
{
"key" : "lastVisitedProducts",
"value" : "shirt"
}
]' \
https://restapi.netmera.com/rest/3.0/deleteProfileAttributeValue
Parameters
key (Required) : Name of the profile attribute.
value (Required) : Value of the profile attribute.
The following request is used get all device info which belongs to given user.
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
-G \
--data-urlencode extId=id_in_my_system \
--data-urlencode pushPermitted=true \
'https://restapi.netmera.com/rest/3.0/getDevices'
Parameters
extId (Required): External id of user to get devices.
pushPermitted (Optional): If this is set as true, only opt-in devices will be returned. If push permitted set as false, don't check register status fetch all devices. You can see whether register or not register with push permitted parameter in response.
Sample response:
{
"devices": [
{
"platform": "ANDROID",
"token": "push_token",
"deviceModel": null,
"pushPermitted": true
},
{
"platform": "IOS",
"token": null,
"deviceModel": "iPhoneX",
"pushPermitted": false
}
],
"extId": "id_in_my_system"
}
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
-G \
--data-urlencode max=10 \
--data-urlencode offset=0 \
'https://restapi.netmera.com/rest/3.0/getDeviceTokens'
Parameters
max (Optional): Default value is 10. Maximum number of device info to fetch per page.
offset (Optional): Default value is 0. Offset to start fetch from.
Normally, for initially request, you don't need to send max or offset value. In response, you will a have link to fetch next page.
{
"nextPage": "https://restapi.netmera.com/rest/3.0/getDeviceTokens?offset=10&max=10",
"total": 158329,
"devices": [
...
]
}
Use nextPage value to fetch next page as :
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
'https://restapi.netmera.com/rest/3.0/getDeviceTokens?offset=10&max=10'
Here, you can see that offset value is sent as 10 which is number of devices in a page.
Two new APIs, getSegments and getSegmentUsers, have been added to Netmera APIs. Thanks to these APIs, all segments in a panel and users in these segments can be reached. You can see the details below.
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json'" \
-H "X-netmera-os: IOS" \
'https://restapi.netmera.com/rest/3.0/getSegments'
Sample Response
{
"list":[
{
"userCount":6,
"name":"for_test_int",
"id":5883,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":123321,
"name":"int_brand",
"id":5886,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":300450,
"name":"int_product_brand",
"id":5887,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":100,
"name":"int_purcc",
"id":5907,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":12500,
"name":"int_purccc",
"id":5908,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":800000,
"name":"int_purcsca",
"id":5909,
"type":"PRODUCT_SEGMENT"
},
{
"userCount":0,
"name":"CHURN-PREDICT-SEGMENT",
"id":5936,
"type":"PREDICT_SEGMENT"
},
{
"userCount":0,
"name":"SPEND-PREDICT-SEGMENT",
"id":5937,
"type":"PREDICT_SEGMENT"
},
{
"userCount":57,
"name":"ttt_111",
"id":5959,
"type":"STANDARD"
}
]
}
curl -X GET \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json'" \
-H "X-netmera-os: IOS" \
'https://restapi.netmera.com/rest/3.0/getSegmentUsers?id=5960&max=10'
Id (Required): Segment Id. You can try one of the id's in the response returned with getSegments API.
max (Optional) : Default value is 100. Maximum number of user info to fetch per page. Even if a value less than 100 is entered, it returns 100 users. You cannot enter a value greater than 1000.
offset (Optional) : Default value is 0. Offset to start fetch from.
Normally, for initially request, you don't need to send max or offset value. In response, you will a have link to fetch next page.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json'" \
-d '[
{
"messageId": 0
}
]' \
https://restapi.netmera.com/rest/3.0/sendPushApproval
You can update users e-mail preference.
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json'" \
-d ' {
"extIds" : [
"your_xid_id"
]
}' \
https://restapi.netmera.com/rest/3.0/enableEmail
curl -X POST \
-H "X-netmera-api-key: your_rest_api_key" \
-H "Content-Type: application/json'" \
-d ' {
"extIds" : [
"your_xid_id"
]
}' \
https://restapi.netmera.com/rest/3.0/disableEmail
You may update the email information for a user when we have their XID.
curl --location 'https://restapi.netmera.com/rest/3.0/updateEmail'
--header 'Content-Type: application/json'
--header 'X-netmera-api-key: your-api-key'
--data '{
"extId":"your ex id",
"email":"your your email"
}'
You may update the MSISDN information for a user based on their XID.
curl --location 'https://restapi.netmera.com/rest/3.0/updateMsisdn'
--header 'Content-Type: application/json'
--header 'X-netmera-api-key: your-api-key'
--data '{
"extId":"your ex id",
"msisdn":"your your msidin"
}'
Last modified 1mo ago