List User Workspaces
curl -X GET "https://api.example.com/workspaces/?limit=10" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Workspaces retrieved successfully" ,
"data" : {
"workspaces" : [
{
"id" : "workspace123" ,
"name" : "My Water Quality Project" ,
"owner" : "user123" ,
"type" : "private" ,
"rol" : "owner"
}
],
"next_index" : "eyJpZCI6Im5leHQifQ=="
}
}
Retrieve all workspaces owned by the authenticated user.
Endpoint: GET /workspaces/
Authentication: Required (Bearer token)
Query Parameters
Number of items to retrieve (1-100)
Pagination index for next page
Response
Workspace data with pagination Array of workspace objects
Index for next page (if available)
Get All Workspaces (Admin)
curl -X GET https://api.example.com/workspaces/all/ \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
{
"message" : "All workspaces retrieved successfully" ,
"workspaces" : [
{
"id" : "workspace123" ,
"name" : "Production Workspace" ,
"owner" : "user123" ,
"type" : "private" ,
"created_at" : "2024-01-15T10:30:00Z"
}
]
}
Retrieve all workspaces in the system. This endpoint is restricted to admin users only.
Endpoint: GET /workspaces/all/
Authentication: Required (Admin role only)
Response
Array of all workspace objects in the system Workspace unique identifier
Workspace type (private or public)
This endpoint requires admin privileges. Regular users will receive a 403 Forbidden error.
Get Workspace by ID
curl -X GET https://api.example.com/workspaces/workspace123 \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Workspace retrieved successfully" ,
"data" : {
"id" : "workspace123" ,
"name" : "My Water Quality Project" ,
"owner" : "user123" ,
"type" : "private" ,
"rol" : "owner" ,
"user" : {
"uid" : "user123" ,
"email" : "[email protected] " ,
"username" : "johndoe"
}
}
}
Retrieve a specific workspace by ID.
Endpoint: GET /workspaces/{id}
Authentication: Required (Bearer token)
Path Parameters
Response
Workspace details including owner information
Create Workspace
curl -X POST https://api.example.com/workspaces/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "New Water Quality Project",
"type": "private"
}'
{
"message" : "Workspace created successfully" ,
"data" : {
"id" : "workspace456" ,
"name" : "New Water Quality Project" ,
"owner" : "user123" ,
"type" : "private" ,
"rol" : "owner"
}
}
Create a new workspace.
Endpoint: POST /workspaces/
Authentication: Required (Bearer token)
Request Body
Workspace name (3-50 characters)
Workspace type: private or public
Response
Update Workspace
curl -X PUT https://api.example.com/workspaces/workspace123 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Project Name",
"type": "public"
}'
{
"message" : "Workspace updated successfully" ,
"data" : {
"id" : "workspace123" ,
"name" : "Updated Project Name" ,
"owner" : "user123" ,
"type" : "public" ,
"rol" : "owner"
}
}
Update workspace details.
Endpoint: PUT /workspaces/{id}
Authentication: Required (Bearer token, must be owner)
Path Parameters
Request Body
Workspace type: private or public
Response
Delete Workspace
curl -X DELETE https://api.example.com/workspaces/workspace123 \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Workspace deleted successfully"
}
Delete a workspace.
Endpoint: DELETE /workspaces/{id}
Authentication: Required (Bearer token, must be owner)
Path Parameters
Response
List Shared Workspaces
curl -X GET "https://api.example.com/workspaces/share/?limit=10" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Shares retrieved successfully" ,
"workspaces" : {
"workspaces" : [
{
"id" : "workspace789" ,
"name" : "Shared Project" ,
"owner" : "otheruser123" ,
"type" : "private" ,
"rol" : "viewer" ,
"guest" : "user123"
}
],
"next_index" : null
}
}
Get workspaces that have been shared with the authenticated user.
Endpoint: GET /workspaces/share/
Authentication: Required (Bearer token)
Query Parameters
Number of items to retrieve (1-100)
List Public Workspaces
curl -X GET "https://api.example.com/workspaces/public/?limit=10"
{
"message" : "Public workspaces retrieved successfully" ,
"workspaces" : {
"workspaces" : [
{
"id" : "workspace999" ,
"name" : "Public Water Quality Data" ,
"rol" : "viewer"
}
],
"next_index" : null
}
}
Get all public workspaces.
Endpoint: GET /workspaces/public/
Authentication: None required
Query Parameters
Number of items to retrieve (1-100)
Get Workspace Guests
curl -X GET https://api.example.com/workspaces/workspace123/guest/ \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Guests retrieved successfully" ,
"guests" : [
{
"uid" : "guest123" ,
"email" : "[email protected] " ,
"username" : "guestuser" ,
"rol" : "viewer"
}
]
}
Get all guests (collaborators) for a workspace.
Endpoint: GET /workspaces/{id}/guest/
Authentication: Required (Bearer token, must be owner)
Path Parameters
Add Guest to Workspace
curl -X POST https://api.example.com/workspaces/workspace123/guest/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"guest": "[email protected] ",
"rol": "viewer"
}'
{
"message" : "Guest created successfully" ,
"guest" : {
"uid" : "guest123" ,
"email" : "[email protected] " ,
"username" : "guestuser" ,
"rol" : "viewer"
}
}
Add a guest (collaborator) to a workspace. An invitation email will be sent.
Endpoint: POST /workspaces/{id}/guest/
Authentication: Required (Bearer token, must be owner)
Path Parameters
Request Body
Email address of the user to invite
Role for the guest: viewer, editor, or admin
Update Guest Role
curl -X PUT https://api.example.com/workspaces/workspace123/guest/guest123 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"rol": "editor"
}'
{
"message" : "Guest updated successfully" ,
"guest" : {
"uid" : "guest123" ,
"email" : "[email protected] " ,
"username" : "guestuser" ,
"rol" : "editor"
}
}
Update a guest’s role in the workspace.
Endpoint: PUT /workspaces/{id}/guest/{guest}
Authentication: Required (Bearer token, must be owner)
Path Parameters
Request Body
New role: viewer, editor, or admin
Remove Guest from Workspace
curl -X DELETE https://api.example.com/workspaces/workspace123/guest/guest123 \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message" : "Guest deleted successfully" ,
"guest" : {
"uid" : "guest123" ,
"email" : "[email protected] " ,
"username" : "guestuser" ,
"rol" : "viewer"
}
}
Remove a guest from the workspace.
Endpoint: DELETE /workspaces/{id}/guest/{guest}
Authentication: Required (Bearer token, must be owner)
Path Parameters