Activity API
The Activity entity is used to manage all the comments and worklogs in Deepser.
Activities can be accessed by all user Roles in the API.
Activities API access changes based on the Main Model (model_alias) the Activity is referring to.
Activity entities are supported for these models:
Model name | Model alias |
Operation | deep_service/operation |
Account | deep_crm/account |
Device | deep_asset/device |
Quote | deep_sales/quote |
Contract | deep_contract/contract |
Ci | deep_cmdb/ci |
GET Endpoint
This endpoint retrieves the entity data that has the specified values.
For this endpoint we have 3 mandatory fields:
- activity_id, that contains the id of the activity I want to retrieve.
- model_alias, that contains the model that relates to that specific activity.
- model_id, that contains the id of the model that this activity relates to.
HTTP Method: GET
Base Syntax:
http://deepserhost/api/rest/activity/activity/[activity_id]?model_alias=[model_alias]&id=[model_id]
Example Syntax:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
Example Result:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
{
"entity_id": 129,
"type": 1,
"description": null,
"portal_visibility": 0,
"frontend_visibility": 0,
"started_at": null,
"ended_at": null,
"duration": null,
"contract_id": 0,
"contract_line_id": 0,
"contract_line_qty": "0.0000",
"created_by": "admin",
"model_alias": "deep_service/operation",
"model_id": 90,
"status": null,
"formtemplate_id": 0,
"disable_routing": 0,
"updated_at": "2023-07-05 08:55:49",
"created_at": "2023-07-05 08:55:49"
}
PUT Endpoint
This endpoint updates the entity data specified in the body of the request as JSON that has the specified values.
For this endpoint we have 3 mandatory fields:
- activity_id, that contains the id of the activity I want to update.
- model_alias, that contains the model that relates to that specific activity.
- model_id, that contains the id of the model that this activity relates to.
HTTP Method: PUT
Base Syntax:
http://deepserhost/api/rest/activity/activity/[activity_id]?model_alias=[model_alias]&id=[model_id]
Example Syntax:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
Example Syntax:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
Body of the request:
{
"description": "Test Description"
}
Please make sure that the key of the JSON data matches the field code of the entity that you want to update otherwise it will not be updated. In this case we will update the description field of this entity.
The response of this API call will be the updated version of the entity.
{
"entity_id": 128,
"type": 2,
"description": "Test Description",
"portal_visibility": 0,
"frontend_visibility": 0,
"started_at": "2023-02-07 11:15:00",
"ended_at": "2023-02-07 12:30:00",
"duration": 4500,
"contract_id": 1,
"contract_line_id": 1,
"contract_line_qty": "0.0000",
"created_by": "demo.key.user",
"model_alias": "deep_service/operation",
"model_id": 90,
"status": 1,
"formtemplate_id": 45,
"disable_routing": 0,
"updated_at": "2023-07-05 08:28:45",
"created_at": "2023-02-07 11:34:00"
}
POST Endpoint
This endpoint creates a new Activity entity with data given in the body of the request as JSON that has the specified model_alias and operation_id.
For this endpoint we have 2 mandatory fields:
- model_alias, that contains the model that relates to the activities I want to create.
- model_id, that contains the id of the model that this activity will relate to.
HTTP Method: POST
Base Syntax:
http://deepserhost/api/rest/activity/activities?model_alias=[model_alias]&id=[model_id]
Example Syntax:
http://deepserhost/api/rest/activity/activities?model_alias=deep_service/operation&id=196
Example Result:
http://deepserhost/api/rest/activity/activities?model_alias=deep_service/operation&id=196
Body of the request:
{
"type": 1,
"description": "Test Description",
"portal_visibility": 0,
"frontend_visibility": 0
}
Please make sure that the keys of the JSON data match the field codes of the entity that you want to create otherwise the entity will be created with only the corresponded fields. In this case we will create a new Activity with the given data in the body of the request.
The response of this API call will be the updated version of the entity.
{
"type": 1,
"descritpion": "Test Description",
"portal_visibility": 0,
"frontend_visibility": 0,
"model_alias": "deep_service/operation",
"model_id": 90,
"created_by": "admin",
"created_at": "2023-07-05 09:00:30",
"updated_at": "2023-07-05 09:00:30",
"entity_id": 130
}
DELETE Endpoint
This endpoint Deletes the entity that has the specified activity_id, model_alias, model_id.
For this endpoint we have 3 mandatory fields:
- activity_id, that contains the id of the activity I want to delete.
- model_alias, that contains the model that relates to that specific activity.
- model_id, that contains the id of the model that this activity relates to.
HTTP Method: DELETE
Base Syntax:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
Example Syntax:
http://deepserhost/api/rest/activity/activities?model_alias=deep_service/operation&id=196
Example Result:
http://deepserhost/api/rest/activity/activity/234?model_alias=deep_service/operation&id=196
This method doesn’t return any response.
Load multiple entities Endpoint
This endpoint retrieves all entities that have the specified model_alias and model_id.
For this endpoint we have 2 mandatory fields:
- model_alias, that contains the model that relates to the activities I want to retrieve.
- model_id, that contains the id of the model that these activities relate to.
HTTP Method: GET
Base Syntax:
http://deepserhost/api/rest/activity/activities/?model_alias=[model_alias]&id=[model_id]
Example Syntax:
http://deepserhost/api/rest/activity/activities/?model_alias=deep_service/operation&id=196
Example Result:
http://deepserhost/api/rest/activity/activities/?model_alias=deep_service/operation&id=196
The response:
{
"totalRecords": 7,
"items": [
{
"entity_id": 124,
"type": 1,
"description": "Dear user, I kindly ask you to give us a date to get your computer.
The technician is available tomorrow at 2 pm or the day after tomorrow at 3 pm.
Thank you.
",
"portal_visibility": 1,
"frontend_visibility": 0,
"started_at": null,
"ended_at": null,
"duration": null,
"contract_id": 0,
"contract_line_id": 0,
"contract_line_qty": "0.0000",
"created_by": "admin.demo",
"model_alias": "deep_service/operation",
"model_id": 90,
"status": null,
"formtemplate_id": 44,
"disable_routing": 0,
"updated_at": "2023-02-07 10:41:35",
"created_at": "2023-02-07 10:41:35",
"create_by_data": {
"username": "admin.demo",
"display_username": "DEMO ADMIN",
"avatar_url": "https://kevin.deepser.net/media/user/image/default/12.png"
},
"created_at_date": "7/2/2023 10:41 AM"
},
{
"entity_id": 125,
"type": 1,
"description": "I prefer tomorrow at 2PM.
\r\nThank you.
",
"portal_visibility": 1,
"frontend_visibility": 0,
"started_at": null,
"ended_at": null,
"duration": null,
"contract_id": 0,
"contract_line_id": 0,
"contract_line_qty": "0.0000",
"created_by": "user",
"model_alias": "deep_service/operation",
"model_id": 90,
"status": null,
"formtemplate_id": 44,
"disable_routing": 0,
"updated_at": "2023-02-07 10:43:14",
"created_at": "2023-02-07 10:43:14",
"create_by_data": {
"username": "user",
"display_username": "Demo User",
"avatar_url": "https://kevin.deepser.net/media/user/image/default/9.png"
},
"created_at_date": "7/2/2023 10:43 AM"
}
]
}