Activities
Activity
Activities are form of registering the actions performed during a booking.
They're divided into 2 main types:
comment
(created by the users)actions
(triggered by the backend).
user_created:
comment
backend_generated:
# booking
booking_created
booking_changed_dates
booking_status_changed
# customer
booking_customer_set
# booking_item
booking_item_created
booking_item_picked_up
booking_item_returned
booking_item_kept_deposit
# booking_service
booking_service_created
# payments
booking_payment_status_updated
payment_rental_status_changed
payment_deposit_status_changed
GET /api/saas/me/bookings/{booking_internal_id}/activities
Description:
Returns a list of all activities associated to the booking, sorted by created_at: :descending, kind: :descending
by default.
Parameters:
Authorization
- Location:
header
- Type:
string
- Required:
true
- Description: The authentication token required to access the endpoint.
- Location:
Auth0-IdToken
- Location:
header
- Type:
string
- Required:
false
- Description: The auth0 idToken from the user.
- Location:
Accept-Language
- Location:
header
- Type:
number
- Required:
false
- Description: Response language,
en
andpt
are supported.
- Location:
booking_internal_id
- Location:
path
- Type:
number
- Required:
true
- Description: The internal ID of the booking.
- Location:
Request Example:
curl -X GET \
https://rnters-staging.herokuapp.com/api/saas/me/bookings/{booking_internal_id}/activities \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [access_token]'
Response Example:
{
"data": [
{
"id": "10",
"type": "activity",
"attributes": {
"kind": "booking_item_returned",
"properties": {
"attrs": ["returned_quantity"],
"params": { "new": 1, "old": 0 }
},
"created_at": "2024-03-24T15:15:00Z",
"updated_at": "2024-03-24T15:15:00Z"
}
},
{
"id": "9",
"type": "activity",
"attributes": {
"kind": "booking_status_changed",
"properties": {
"attrs": ["status"],
"params": { "new": "completed", "old": "ongoing" }
},
"created_at": "2024-03-24T15:15:00Z",
"updated_at": "2024-03-24T15:15:00Z"
}
},
{
"id": "8",
"type": "activity",
"attributes": {
"kind": "booking_item_picked_up",
"properties": {
"attrs": ["picked_up_quantity"],
"params": { "new": 1, "old": 0 }
},
"created_at": "2024-03-23T15:15:00Z",
"updated_at": "2024-03-23T15:15:00Z"
}
},
{
"id": "7",
"type": "activity",
"attributes": {
"kind": "booking_status_changed",
"properties": {
"attrs": ["status"],
"params": { "new": "ongoing", "old": "reserved" }
},
"created_at": "2024-03-23T15:15:00Z",
"updated_at": "2024-03-23T15:15:00Z"
}
},
{
"id": "6",
"type": "activity",
"attributes": {
"kind": "booking_status_changed",
"properties": {
"attrs": ["status"],
"params": { "new": "reserved", "old": "drafting" }
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
},
{
"id": "5",
"type": "activity",
"attributes": {
"kind": "booking_service_created",
"properties": {
"attrs": ["created_at"],
"params": { "service_kind": "insurance" }
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
},
{
"id": "4",
"type": "activity",
"attributes": {
"kind": "booking_item_created",
"properties": {
"attrs": ["created_at"],
"params": { "item_title": "Mediocre Marble Coat" }
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
},
{
"id": "2",
"type": "activity",
"attributes": {
"kind": "booking_customer_set",
"properties": {
"attrs": ["customer_id"],
"params": { "customer_internal_id": 2 }
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
},
{
"id": "3",
"type": "activity",
"attributes": {
"kind": "booking_changed_dates",
"properties": {
"attrs": ["start_at", "end_at"],
"params": {
"new_end_at": "2024-03-24T15:15:00.000Z",
"old_end_at": null,
"new_start_at": "2024-03-23T15:15:00.000Z",
"old_start_at": null
}
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
},
{
"id": "1",
"type": "activity",
"attributes": {
"kind": "booking_created",
"properties": {
"attrs": ["created_at"],
"params": { "booking_id": 1 }
},
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-22T15:29:46Z"
}
}
]
}
Endpoint
POST /api/saas/me/bookings/{booking_internal_id}/activities
Description:
Creates a new comment activity.
Parameters:
Authorization
- Location:
header
- Type:
string
- Required:
true
- Description: The authentication token required to access the endpoint.
- Location:
Auth0-IdToken
- Location:
header
- Type:
string
- Required:
false
- Description: The auth0 idToken from the user.
- Location:
Accept-Language
- Location:
header
- Type:
number
- Required:
false
- Description: Response language,
en
andpt
are supported.
- Location:
booking_internal_id
- Location:
path
- Type:
number
- Required:
true
- Description: The internal ID of the booking.
- Location:
activity
- Location:
body
- Required:
true
- Description: The content of the activity to be processed.
- Location:
Activity Attributes:
comment
- Type:
string
- Description: The comment message.
- Limit: 4000 characters.
- Type:
attachment_id
- Type:
string
- Description: The signed id for document attachment.
- Size Limit: 10 MB
- Type:
Request Example:
curl -X POST http://rnters-staging.herokuapp.com/api/saas/me/bookings/{booking_internal_id}/activities \
-H 'Authorization: Bearer your_token' \
-H 'Auth0-IdToken: your_id_token' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"type": "activity",
"attributes": {
"properties": {
"comment": "sample comment"
},
"attachment_id": "sample-signed-id"
}
}
}'
Response Example:
{
"data": {
"id": "8",
"type": "activity",
"attributes": {
"kind": "comment",
"properties": { "comment": "sample comment" },
"created_at": "2024-03-23T13:54:01Z",
"updated_at": "2024-03-23T13:54:01Z",
"attachment_url": "FILE_URL",
"attachment_preview": "PREVIEW_URL",
"attachment_filename": "dummy.pdf",
"attachment_content_type": "application/pdf",
"attachment_metadata": {}
}
}
}
Endpoint
PUT /api/saas/me/bookings/{booking_internal_id}/activities/{id}
Description:
Updates a comment activity.
Parameters:
Authorization
- Location:
header
- Type:
string
- Required:
true
- Description: The authentication token required to access the endpoint.
- Location:
Auth0-IdToken
- Location:
header
- Type:
string
- Required:
false
- Description: The auth0 idToken from the user.
- Location:
Accept-Language
- Location:
header
- Type:
number
- Required:
false
- Description: Response language,
en
andpt
are supported.
- Location:
booking_internal_id
- Location:
path
- Type:
number
- Required:
true
- Description: The internal ID of the booking.
- Location:
id
- Location:
path
- Type:
number
- Required:
true
- Description: The id of the activity.
- Location:
activity
- Location:
body
- Required:
true
- Description: The content of the activity to be processed.
- Location:
Activity Attributes:
comment
- Type:
string
- Description: The comment message.
- Limit: 4000 characters.
- Type:
attachment_id
- Type:
string
- Description: The signed id for document attachment.
- Size Limit: 10 MB
- Type:
Request Example:
curl -X PUT 'http://rnters-staging.herokuapp.com/api/saas/me/bookings/123/activities/456' \
-H 'Authorization: Bearer your_token' \
-H 'Auth0-IdToken: your_id_token' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-d '{
"activity": {
"comment": "Updated comment"
}
}'
Response Example:
{
"data": {
"id": "456",
"type": "activity",
"attributes": {
"comment": "Updated comment",
"created_at": "2024-03-22T15:29:46Z",
"updated_at": "2024-03-24T15:15:00Z"
}
}
}
Endpoint
DELETE /api/saas/me/bookings/{booking_internal_id}/activities/{id}
Description:
Deletes a comment activity.
Parameters:
Authorization
- Location:
header
- Type:
string
- Required:
true
- Description: The authentication token required to access the endpoint.
- Location:
Auth0-IdToken
- Location:
header
- Type:
string
- Required:
false
- Description: The auth0 idToken from the user.
- Location:
Accept-Language
- Location:
header
- Type:
number
- Required:
false
- Description: Response language,
en
andpt
are supported.
- Location:
booking_internal_id
- Location:
path
- Type:
number
- Required:
true
- Description: The internal ID of the booking.
- Location:
id
- Location:
path
- Type:
number
- Required:
true
- Description: The id of the activity.
- Location:
Request Example:
curl -X DELETE 'http://rnters-staging.herokuapp.com/api/saas/me/bookings/123/activities/456' \
-H 'Authorization: Bearer your_token' \
-H 'Auth0-IdToken: your_id_token' \
-H 'Accept-Language: en'
Last modified: 8 months ago