API activity - RapturePlatform/Rapture GitHub Wiki
The activity API gives clients and programs the ability to record messages about changes and status for common activity running in the system. One common use case of activities is to see what percentage of a certain task is complete and what the last message associated with that task was.
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
String retVal = activityApi.createActivity(description, message, progress, max);
retVal = baseAPI.doActivity_CreateActivity(description, message, progress, max);
Entitlement: /activity/write
This method creates and starts recording a new activity. It returns a unique id that can be used to update the status of the activity.
Parameter | Type | Description |
---|---|---|
description | String | |
message | String | |
progress | Long | |
max | Long |
Type | Description |
---|---|
String |
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
boolean retVal = activityApi.updateActivity(activityId, message, progress, max);
retVal = baseAPI.doActivity_UpdateActivity(activityId, message, progress, max);
Entitlement: /activity/write
This method updates the status of an activity. The return value is false if the activity was already marked as finished or aborted. If the value is false, this function will not take effect.
Parameter | Type | Description |
---|---|---|
activityId | String | |
message | String | |
progress | Long | |
max | Long |
Type | Description |
---|---|
boolean |
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
boolean retVal = activityApi.finishActivity(activityId, message);
retVal = baseAPI.doActivity_FinishActivity(activityId, message);
Entitlement: /activity/write
This method marks an activity as finished. The return value is false if the activity was already marked as finished or aborted. If the value is false, this function will not take effect.
Parameter | Type | Description |
---|---|---|
activityId | String | |
message | String |
Type | Description |
---|---|
boolean |
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
boolean retVal = activityApi.requestAbortActivity(activityId, message);
retVal = baseAPI.doActivity_RequestAbortActivity(activityId, message);
Entitlement: /activity/write
This method is used to request that an activity abort. This will indicate to callers of updateActivity that the request is aborted, via the return value of calls that write to this activity, such as updateActivity or recordActivity. The return value is false if the activity was already marked as finished or aborted. If the value is false, this function will not take effect.
Parameter | Type | Description |
---|---|---|
activityId | String | |
message | String |
Type | Description |
---|---|
boolean |
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
ActivityQueryResponse retVal = activityApi.queryByExpiryTime(nextBatchId, batchSize, lastSeen);
retVal = baseAPI.doActivity_QueryByExpiryTime(nextBatchId, batchSize, lastSeen);
Entitlement: /activity/read
Retrieve activities updated after a given timestamp - nextBatchId: the id for the batch, if this is not the first request. Empty string to indicate the first request
- batchSize: the maximum number of items you want to see in this batch. Maximum is 10000 -- if the number passed in is > 10k, it gets set to 10k. - lastSeen: an epoch timestamp in milliseconds. only activities that were last updated after this time will be returned
Parameter | Type | Description |
---|---|---|
nextBatchId | String | |
batchSize | Long | |
lastSeen | Long |
Type | Description |
---|---|
ActivityQueryResponse |
A response to a query on Activities
Field | Type |
---|---|
isLast | Boolean |
nextBatchId | String |
activities | List |
HttpActivityApi activityApi = new HttpActivityApi(loginApi);
Activity retVal = activityApi.getById(activityId);
retVal = baseAPI.doActivity_GetById(activityId);
Entitlement: /activity/read
Get an activity by id
Parameter | Type | Description |
---|---|---|
activityId | String |
Type | Description |
---|---|
Activity |
An activity.
Field | Type |
---|---|
id | String |
description | String |
message | String |
progress | Long |
max | Long |
lastSeen | Long |
status | ActivityStatus |