Listing block models
List all block models within the workspace workspace_id
using the List all block models in a workspace endpoint, or list all block models in the organization org_id
using the List all block models in an organization endpoint. While they are different endpoints, the request and response bodies are the same.
Request
Method | Request URL | Description |
---|---|---|
GET | /orgs/{org_id}/workspaces/{workspace_id}/block-models | List all block models in the workspace workspace_id . |
GET | /orgs/{org_id}/block-models | List all block models in the organization org_id . |
Query parameters
Query parameter | Description |
---|---|
deleted | Optional. The boolean parameter deleted specifies whether the response will only list block models that were deleted via the Delete block model endpoint. This list will not include block models that are within deleted workspaces. Default value is false . |
offset | Optional. Integer index of the first item to return. Default value is 0 . |
limit | Optional. Maximum number of items to return in the list. Must be greater than 0 and less than or equal to 100 . Default value is 50 . |
Response
On success, the API will respond with the HTTP status code 200 OK
and a response body containing the PaginatedResponse[BlockModel]
object.
Response Body
The PaginatedResponse[BlockModel]
object contains the list of block models as well as metadata pertaining to pagination.
{
"results": list[BlockModel],
"count": int,
"total": int,
"limit": int,
"offset": int
}
Schema field | Description |
---|---|
results | List of block models. Empty if no results can be returned. |
count | The number of block models returned in results . |
total | Total number of block models in the full list without pagination. |
limit | Maximum number of items requested. |
offset | Index of the first item in results with respect to the full list without pagination. |
Example: List block models in workspace with pagination
If the workspace workspace_id
contains an unknown number of block models, you will likely wish to paginate the results for easier digestion.
You may retrieve a list of the first 10 block models in the workspace workspace_id
using the following request.
Method | Request URL |
---|---|
GET | /orgs/{org_id}/workspaces/{workspace_id}/block-models/?limit=10 |
Since the offset
query parameter has not been provided, the API will use the default value of 0, and will return the first 10 block models in the full list.
{
"results": list[BlockModel],
"count": 10,
"total": 134,
"limit": 10,
"offset": 0
}
From the response body, we see that the total number of block models is 134, and that the API has returned 10 items in the results
list. The requested limit
and offset
is also shown in the response.
To page through the next 10 block models, you may use the following request.
Method | Request URL |
---|---|
GET | /orgs/{org_id}/workspaces/{workspace_id}/block-models/?limit=10&offset=10 |
{
"results": list[BlockModel],
"count": 10,
"total": 134,
"limit": 10,
"offset": 10
}