Content Types

The /types endpoint allows you to manage your Content Types.

List Content Types

Endpoint: /types

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Query Parameters

ParameterData TypeDescription
namestringOptional name to filter by.
chunckablebooleanOptional flag to filter by whether the type is chunkable.
layoutbooleanIf true, the response will include the table layout for each type.
limitnumberOptional maximum number of results to return.
offsetnumberOptional offset to start returning results from.

Example Request

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types?name=MyType&layout=true' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

[
  {
    "id": "<OBJECT_ID>",
    "name": "MyType",
    "description": "My content type",
    "table_layout": [
      {
        "field": "properties.title",
        "name": "Title",
        "type": "string"
      },
      {
        "field": "properties.description",
        "name": "Description",
        "type": "string"
      },
      {
        "field": "properties.author",
        "name": "Author",
        "type": "string"
      }
    ],
    "updated_by": "user:<USER_ID>",
    "created_by": "user:<USER_ID>",
    "created_at": "2023-09-25T14:17:56.411Z",
    "updated_at": "2023-09-25T14:17:56.411Z"
  }
]

Code Examples

List Content Types

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types?name=MyType&layout=true' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Retrieve a Content Type

Endpoint: /types/<TYPE_ID>

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterDescription
<TYPE_ID>The ID of the content type to retrieve.

Example Request

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
  "id": "<OBJECT_ID>",
  "name": "MyType",
  "description": "My content type",
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ],
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "updated_by": "user:<USER_ID>",
  "created_by": "user:<USER_ID>",
  "created_at": "2023-09-25T14:17:56.411Z",
  "updated_at": "2023-09-25T14:17:56.411Z"
}

Code Examples

Retrieve a Content Type

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Retrieve a Content Type by Name

Endpoint: /types/name/<TYPE_NAME>

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterDescription
<TYPE_NAME>The name of the content type to retrieve.

Example Request

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types/name/<TYPE_NAME>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
  "id": "<OBJECT_ID>",
  "name": "MyType",
  "description": "My content type",
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ],
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "updated_by": "user:<USER_ID>",
  "created_by": "user:<USER_ID>",
  "created_at": "2023-09-25T14:17:56.411Z",
  "updated_at": "2023-09-25T14:17:56.411Z"
}

Code Examples

Retrieve a Content Type by Name

curl --location --request GET 'https://zeno-server-production.api.becomposable.com/api/v1/types/name/<TYPE_NAME>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Create a Content Type

Endpoint: /types

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
namestringThe name of the content type.
descriptionstringAn optional description of the content type.
is_chunkablebooleanWhether the content type is chunkable.
object_schemaJSONSchema4An optional JSON schema for the content type's properties.
table_layoutColumnLayout[]An optional table layout for the content type's properties.

Example Request

curl --location --request POST 'https://zeno-server-production.api.becomposable.com/api/v1/types' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "MyType",
  "description": "My content type",
  "is_chunkable": false,
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ]
}'

Example Response

{
  "id": "<OBJECT_ID>",
  "name": "MyType",
  "description": "My content type",
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ],
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "updated_by": "user:<USER_ID>",
  "created_by": "user:<USER_ID>",
  "created_at": "2023-09-25T14:17:56.411Z",
  "updated_at": "2023-09-25T14:17:56.411Z"
}

Code Examples

Create a Content Type

curl --location --request POST 'https://zeno-server-production.api.becomposable.com/api/v1/types' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "MyType",
  "description": "My content type",
  "is_chunkable": false,
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ]
}'

Update a Content Type

Endpoint: /types/<TYPE_ID>

Method: PUT

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterDescription
<TYPE_ID>The ID of the content type to update.

Input Parameters

ParameterData TypeDescription
namestringThe name of the content type.
descriptionstringAn optional description of the content type.
is_chunkablebooleanWhether the content type is chunkable.
object_schemaJSONSchema4An optional JSON schema for the content type's properties.
table_layoutColumnLayout[]An optional table layout for the content type's properties.

Example Request

curl --location --request PUT 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "MyUpdatedType",
  "description": "My updated content type"
}'

Example Response

{
  "id": "<OBJECT_ID>",
  "name": "MyUpdatedType",
  "description": "My updated content type",
  "table_layout": [
    {
      "field": "properties.title",
      "name": "Title",
      "type": "string"
    },
    {
      "field": "properties.description",
      "name": "Description",
      "type": "string"
    },
    {
      "field": "properties.author",
      "name": "Author",
      "type": "string"
    }
  ],
  "object_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "author": {
        "type": "string"
      }
    },
    "required": [
      "title",
      "description",
      "author"
    ]
  },
  "updated_by": "user:<USER_ID>",
  "created_by": "user:<USER_ID>",
  "created_at": "2023-09-25T14:17:56.411Z",
  "updated_at": "2023-09-25T14:17:56.411Z"
}

Code Examples

Update a Content Type

curl --location --request PUT 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "MyUpdatedType",
  "description": "My updated content type"
}'

Delete a Content Type

Endpoint: /types/<TYPE_ID>

Method: DELETE

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterDescription
<TYPE_ID>The ID of the content type to delete.

Example Request

curl --location --request DELETE 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
  "id": "<OBJECT_ID>"
}

Code Examples

Delete a Content Type

curl --location --request DELETE 'https://zeno-server-production.api.becomposable.com/api/v1/types/<TYPE_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Find Content Types

Endpoint: /types/find

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
queryRecord<string, any>The query to use to find content types.
limitnumberOptional maximum number of results to return.
selectstringOptional projection to apply to the results.

Example Request

curl --location --request POST 'https://zeno-server-production.api.becomposable.com/api/v1/types/find' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "query": {
    "name": "MyType"
  },
  "limit": 10,
  "select": "name description"
}'

Example Response

[
  {
    "name": "MyType",
    "description": "My content type"
  }
]

Code Examples

Find Content Types

curl --location --request POST 'https://zeno-server-production.api.becomposable.com/api/v1/types/find' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "query": {
    "name": "MyType"
  },
  "limit": 10,
  "select": "name description"
}'

Was this page helpful?