Activities
The Activities API is an important part of OpenTransact. Anytime any data in the system is created, or modified in any way, an event is created for each object that changes. This allows you to track changes to your data over time, and also allows the Rules Engine to trigger rules based on changes to your data.
In this way you can automate your entire payments orchestration layer to do things like automatically update the status of a payment based on the rules you define, check a third-party API prior to processing a payment, or even route payments to different systems based on your own custom logic.
Data Types
ActivityResponse
Key | Value | Notes |
---|---|---|
type | activities | |
id | UUID | |
Attributes | ||
action | created or updated or deleted | |
previous | Object | The serialized subject value prior to the activity ocurring (if new will be {} ) |
current | Object | The serialized subject value after the event completed |
diff | Object | The diff between previous and current |
metadata | Metadata | |
created-at | Timestamp | |
updated-at | Timestamp | |
Relationships | ||
profile | ProfileRelathionship | |
author | AuthorRelationship | |
application | ApplicationRelationship | |
subject | SubjectRelationship |
ActivityResponse Example
{
"type": "activities",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"attributes": {
"action": "created",
"previous": {},
"current": {},
"diff": {},
"metadata": {},
"created-at": "2022-06-21T23:34:04Z",
"updated-at": "2022-06-21T23:34:04Z"
},
"relationships": {
"profile": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"author": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"application": {
"data": {
"type": "applications",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"subject": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
}
}
}
List Activities
This endpoint retrieves a paginated list of Activities. By default, a maximum of thirty Activities are shown per page.
This endpoint returns an array of ActivityResponse objects.
Filters
- Name
created_between
- Type
- object
- Description
- See documentation for filtering by timestamps.
- Name
updated_between
- Type
- object
- Description
- See documentation for filtering by timestamps.
- Name
metadata
- Type
- object
- Description
- See documentation for filtering by metadata.
- Name
page
- Type
- object
- Description
- See documentation for pagination.
Request
curl --request GET \
--url 'https://api.opentransact.com/v1/activities \
--header 'Authorization: Basic {API_KEY}'
Response
{
"data": [
{
"type": "activities",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"attributes": {
"action": "created",
"previous": {},
"current": {},
"diff": {},
"metadata": {}
},
"relationships": {
"profile": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"author": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"application": {
"data": {
"type": "applications",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
},
"subject": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
}
}
},
... // 29 more
],
"meta": {
"current-page": 1,
"page-count": 2,
"count": 38
},
"links": {
"self": "https://api.opentransact.com/v1/activities?page%5Bnumber%5D=1&page%5Bsize%5D=30",
"first": "https://api.opentransact.com/v1/activities?page%5Bnumber%5D=1&page%5Bsize%5D=30",
"next": "https://api.opentransact.com/v1/activities?page%5Bnumber%5D=2&page%5Bsize%5D=30",
"last": "https://api.opentransact.com/v1/activities?page%5Bnumber%5D=2&page%5Bsize%5D=30"
}
}