APIs
Getting StartedExecution API ReferenceCustom Actions
Getting StartedCustom Actions ReferenceUsing external APIs in Custom ActionsThis API should be used by third party applications to:
- Get information about an environment’s databases, like a list of available databases in an environment
- Read database records and their files
- Write and update database records
This API cannot currently be used to
- Read a filtered or sorted list of values
- Upload files
List available databases for an environment
To list available databases in a given environment, the environment must be specified in the API call. This can be found in the URL of the environment configuration in the BRYTER admin panel, i.e. https://site.bryter.io/admin/environments/
<environment id>
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/environments/<environment id> \
--header 'Authorization: Bearer <Api Key>'
Note that there are two database identifiers returned in the response:
caseDatabaseId
is the internal database ID, that one would find in the authoring interface i.e. https://site.bryter.io/databases/
<caseDatabaseId>
. This can be useful for determining which database you intend to access.
The second identifier in this response is publishedCaseDatabaseId
, the ID of the published database in the requested environment.
caseDatabaseId
may have several publishedCaseDatabaseId
, as one exists for each environment in which it is available. Listed in this call will be the publishedCaseDatabaseId
applicable for the requests environment and to which this key belongs.Example response:
{
"data": {
"databases": [
{
"name": "database name",
"caseDatabaseId": "YpPgQY2nRuK-S2pa6WBVog",
"publishedCaseDatabaseId": "C01qgWZNT4O5Ne3ZbT3FpQ"
},
{
"name": "other database name",
"caseDatabaseId": "N-EDkQzYSgmOzAi2IUoS2Q",
"publishedCaseDatabaseId": "QziEwjj5S2SKAJGEDYuySQ"
}
]
}
}
You can also define a databaseName
parameter to return only databases that have a name containing a specific term:
curl --request GET \
--url 'https://<tenant>.bryter.io/api/databases/environments/<environment id>?databaseName=<some name>' \
--header 'Authorization: Bearer <Api Key>'
Read database configuration
To get information about a database configuration
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id> \
--header 'Authorization: Bearer <Api Key>'
You will see a list of field names as configured, as well as static identifiers and their types.
Example response:
{
"data": {
"name": "database name",
"fields": [
{
"id": "id",
"name": "id",
"type": {
"name": "ID"
}
},
{
"id": "created_at",
"name": "Created at",
"type": {
"name": "CREATED_AT"
}
},
{
"id": "updated_at",
"name": "Last update",
"type": {
"name": "UPDATED_AT"
}
},
{
"id": "c_text_0001",
"name": "Field Label",
"type": {
"name": "STRING"
}
}
]
}
}
Read data
To read data
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries \
--header 'Authorization: Bearer <API Key>'
This will return all records, ordered by creation date.
You can optionally specify page size and which page you wish to access. The default page size is 20
, and the maximum size per page is limited to 10,000 records.
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries?page=1&entriesPerPage=100 \
--header 'Authorization: Bearer <API Key>'
Example response:
{
"data": {
"entries": [
{
"id": "40f39b15-d4a6-4b77-9fa7-49b7649c6811",
"created_at": "2023-01-31T14:16:29.669177Z",
"updated_at": "2023-01-31T14:16:29.669177Z",
"c_text_0001": "some text",
"c_date_0002": "2023-01-14T00:00:00Z",
"c_number_0003": 4.0,
"c_email_0004": "mail@example.com",
"c_file_0005": "VziEwjj5SQSKAJGEDYuySQ"
},
{
"id": "dd65620a-15f8-440b-bad2-ea439c64200a",
"created_at": "2023-01-31T14:14:29.445377Z",
"updated_at": "2023-01-31T14:14:29.445377Z",
"c_text_0001": "Test data",
"c_file_0005": "C01pgWZNT4OQNe3ZbT3FpQ"
}
]
},
"pageInfo": {
"page": 1,
"totalPages": 1,
"totalElements": 2
}
}
To return a single record you can specify the identifier by
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entry?entryId=<entry id> \
--header 'Authorization: Bearer <API Key>'
🚨DEPRECATED: To return a single record you can specify the identifier by
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries/<entry id> \
--header 'Authorization: Bearer <API Key>'
Note that entry identifiers will need to be URL encoded.
Example response:
{
"data": {
"id": "40f39b15-d4a6-4b77-9fa7-49b7649c6811",
"created_at": "2023-01-31T14:16:29.669177Z",
"updated_at": "2023-01-31T14:16:29.669177Z",
"c_text_0001": "some text",
"c_date_0002": "2023-01-14T00:00:00Z",
"c_number_0003": 4.0,
"c_email_0004": "mail@example.com",
"c_file_0005": "VziEwjj5SQSKAJGEDYuySQ"
}
}
Read files
Files written into BRYTER databases are not actually stored in the database, but rather behind authenticated storage. To retrieve a file from authenticated storage using a blobId
, an additional API call must be made. The blobId
needed to request the file is the id that is returned in the response of the read entries request for FILE
type fields (e.g. c_file_0005
in the above “Read data” example).
curl --request GET \
--url https://<tenant>.bryter.io/api/databases/<published database id>/blobs/<blob id> \
--header 'Authorization: Bearer <API Key>'
Create a record and generate an identifier
Data can be created and added to the database via a POST request.
To create a record you need to POST the entry as json data using the “field ids” as returned in the database configuration.
When a record is created via a POST request, the ID of the newly created record is returned in the response.
curl --request POST \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries \
--header 'Authorization: Bearer <API Key>'
--header 'Content-Type: application/json' \
--data '{
"c_number_0003": 5.0,
"c_text_0001": "some text"
}'
Example response returning 201 Created with location header:
{
"data": {
"id": "060121c6-f64f-463d-95e0-2bc79de26ced",
"created_at": "2023-01-30T14:30:25.416686Z",
"updated_at": "2023-01-30T14:30:25.416686Z",
"c_number_0003": 5.0,
"c_text_0001": "some text"
}
}
Create or Update a record with a specific identifier
To create a record with a specific ID or update an exiting record, an ID for the record may be provided in the request. If the ID is provided and a record in the database does not already exist with the provided ID, a new record will be created with the ID provided. If a record already exists in the database with the provided ID, the record with the corresponding ID will be updated based on the field values provided in the API request. Any fields which values are not included in the request will not be updated.
If an ID is not provided, BRYTER will generate a unique ID for the record and the ID of the newly created record will be included in the API call response.
Note, the Create or Update Record API Calls are done via a PUT request rather than a POST request.
Files cannot be written via the API.
curl --request PUT \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entry?entryId<record id> \
--header 'Authorization: Bearer <API Key>'
--header 'Content-Type: application/json' \
--data '{
"c_number_0003": 15.0,
"c_text_0001": "some other text"
}'
Example response returning 200 Ok:
{
"data": {
"id": "060121c6-f64f-463d-95e0-2bc79de26ced",
"created_at": "2023-01-30T14:30:25.416686Z",
"updated_at": "2023-01-31T14:30:25.416686Z",
"c_number_0003": 15.0,
"c_text_0001": "some other text"
}
}
🚨DEPRECATED: Create or Update a record with a specific identifier
To target a record with a specific identifier, include the id
in the request URL. If a record with a specified identifier already exists, any specified fields will be overwritten, updating the record. Unspecified fields would be unmodified. Note that operations with a specified ID are done as a PUT.
Files cannot be written via the API.
curl --request PUT \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries/<record id> \
--header 'Authorization: Bearer <API Key>'
--header 'Content-Type: application/json' \
--data '{
"c_number_0003": 15.0,
"c_text_0001": "some other text"
}'
Example response returning 200 Ok:
{
"data": {
"id": "060121c6-f64f-463d-95e0-2bc79de26ced",
"created_at": "2023-01-30T14:30:25.416686Z",
"updated_at": "2023-01-31T14:30:25.416686Z",
"c_number_0003": 15.0,
"c_text_0001": "some other text"
}
}
Delete a record
To delete a record and associated files:
curl --request DELETE \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entry?entryId=<entry id> \
--header 'Authorization: Bearer <API Key>'
A successful deletion will return a 204 No Content response.
🚨DEPRECATED: Delete a record
To delete a record and associated files:
curl --request DELETE \
--url https://<tenant>.bryter.io/api/databases/<published database id>/entries/<entry id> \
--header 'Authorization: Bearer <API Key>'
A successful deletion will return a 204 No Content response.
← Previous