How to manage project-specific data through the API.
Projects are a crucial concept when working with the Seelab API. Upon creating your account, Seelab automatically sets up a unique organization and a default project for you. You can later create additional projects and add collaborators to each one as needed.
A user in Seelab can be part of one or more organizations, and similarly can be involved in multiple projects. This information is accessible via the /user/me endpoint.
The response from the /user/me endpoint provides details about your profile, including associated projects and organizations. The response includes information such as project names, roles within each project, and the organizations you are part of, along with their respective roles.
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"projects": [
{
"id": 1,
"name": "IT Team",
"type": "user",
"organizationId": 1,
"role": "member,
},
{
"id": 2,
"name": "Personnal Workspace",
"organizationId": 2,
"role": "admin"
}
],
"organizations": [
{
"id": 1,
"name": "Seelab.ai",
"role": "member"
},
{
"id": 2,
"name": "John's Organization",
"role": "admin"
}
]
}
Use project in APIs
Many API calls to Seelab can include the projectId
parameter in the request. By specifying projectId
, your calls are scoped to the relevant project, allowing for more precise data handling. If you do not include a projectId
, the default personal project that was created during your initial registration will be used.
Example Usage
For example, the styles endpoint lists all styles within your personal project:
GET /styles
Response:
[
{ "id": 1, "name": "Minimalist", "projectId": 2 },
{ "id": 2, "name": "Vibrant", "projectId": 4 },
{ "id": 3, "name": "Photo", "projectId": 4 }
]
To specify a particular project, include the projectId
as a query parameter, like so:
GET /styles?projectId=4
Response:
[
{ "id": 2, "name": "Vibrant", "projectId": 4 },
{ "id": 3, "name": "Photo", "projectId": 4 }
]
This filtering capability is available for any API call that retrieves data not associated with a unique identifier, giving you the flexibility to manage data across different projects seamlessly.