Content Types

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

List Content Types

Endpoint: /types

Method: GET

Requirements: User must have content:read permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Query Parameters

ParameterData TypeDescription
namestringOptional name to filter by.
chunkablebooleanOptional 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://api.vertesia.io/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 Example

List Content Types

curl --location --request GET \
  'https://api.vertesia.io/api/v1/types?name=MyType&layout=true' \
  --header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Retrieve a Content Type

Endpoint: /types/<TYPE_ID>

Method: GET

Requirements: User must have content:read permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
<TYPE_ID> (Required)stringThe ID of the content type to retrieve.

Example Request

curl --location --request GET \
  'https://api.vertesia.io/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 Example

Retrieve a Content Type

curl --location --request GET \
  'https://api.vertesia.io/api/v1/types/<TYPE_ID>' \
  --header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Retrieve a Content Type by Name

Endpoint: /types/name/<TYPE_NAME>

Method: GET

Requirements: User must have content:read permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
<TYPE_NAME> (Required)stringThe name of the content type to retrieve.

Example Request

curl --location --request GET \
  'https://api.vertesia.io/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 Example

Retrieve a Content Type by Name

curl --location --request GET \
  'https://api.vertesia.io/api/v1/types/name/<TYPE_NAME>' \
  --header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Create a Content Type

Endpoint: /types

Method: POST

Requirements: User must have content:write permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
name (Required)stringThe 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://api.vertesia.io/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 Example

Create a Content Type

curl --location --request POST \
  'https://api.vertesia.io/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

Requirements: User must have content:write permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
<TYPE_ID> (Required)stringThe 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://api.vertesia.io/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 Example

Update a Content Type

curl --location --request PUT \
  'https://api.vertesia.io/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

Requirements: User must have content:delete permission.

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
<TYPE_ID> (Required)stringThe ID of the content type to delete.

Example Request

curl --location --request DELETE \
  'https://api.vertesia.io/api/v1/types/<TYPE_ID>' \
  --header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
  "id": "<OBJECT_ID>"
}

Code Example

Delete a Content Type

curl --location --request DELETE \
  'https://api.vertesia.io/api/v1/types/<TYPE_ID>' \
  --header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Find Content Types

Endpoint: /types/find

Method: POST

Requirements: User must have content:read permission.

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://api.vertesia.io/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 Example

Find Content Types

curl --location --request POST \
  'https://api.vertesia.io/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?