Integry has a Partner API, that lets you set or get tasks limits per user. You'll need your partner key to execute the below APIs as well your app-key, please get in touch with your Integry contact or if you're not enlisted as a partner, click here.
- You can get the current tasks of a user as follows.
GET https://app.integry.io/partners/api/insights/users/<id>/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Response
{
"user_id":"test@example.com", // your user ID
"current_limit":10000,
"limit_period":"30", // in days
"tasks_consumed":5000,
"tasks_remaining":5000,
"limit_reset_after":10 // in days
}
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
- id: This is the user's email id whose current tasks you are fetching
-
2. You can also request for the tasks of all users in an account.
GET https://app.integry.io/partners/api/insights/users/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Response
[
{
"user_id":"yasir@integry.io",
"current_limit":10000,
"limit_period":"30",
"tasks_consumed":5000,
"tasks_remaining":5000,
"tasks_consumed_percent":50,
"tasks_remaining_percent":50,
"limit_reset_after":10
}
]
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
-
3. You can create a subscription for users tasks. You can subscribe to events for various levels for task consumption. We will notify you when that level is breached.
POST https://app.integry.io/partners/api/insights/subscriptions/
Headers
api-key: <partner api key>
Body:
{
"events":[
"user_tasks_limit_80",
"user_tasks_limit_100"
],
"callback_url":"https://example.com/callback"
}
Response
{
"subscription_id":"123-1234-1234-1234"
}
- API-key: This is your API secret and can be found in your account
Here is a sample payload of what we will send to your webhook URL when a user reaches a limit.
Headers:
subscription-id: <a valid subscription id> // it can be used to validate request
Payload:
{
"user_id":"yasir@integry.io",
"current_limit":10000,
"limit_period":"30",
"tasks_consumed":5000,
"tasks_remaining":5000,
"tasks_consumed_percent":50,
"tasks_remaining_percent":50,
"limit_reset_after":10
}
4. You can delete a subscription by the following API.
DELETE https://app.integry.io/partners/api/insights/subscriptions/<subscription_id>/
Headers:
api-key: <partner api key>
Response:
{
"success":true
}
-
-
- API-key: This is your API secret and can be found in your account
-
5. You can also set the task limit for one or more users using the following API call.
POST https://app.integry.io/partners/api/insights/users/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Body:
[
{
"user_id":"yasir@integry.io",
"allowed_tasks":10000
},
{
"user_id":"test@integry.io",
"allowed_tasks":10000
}
]
Response
{
"success":"true"
}
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
- user_id: This is the user's email id whose tasks limit you are setting
-
Comments
0 comments
Please sign in to leave a comment.