Appearance
Components API
Components define the schema/structure for content. They use JSON Schema format to describe the data structure.
Create a Component
Create a new component with a JSON Schema definition.
Endpoint: POST /api/v1/component
Request Body:
The request body should contain a valid JSON Schema. Examples:
Simple String Component
json
{
"title": "A single string",
"type": "string"
}Simple Integer Component
json
{
"title": "A single integer",
"type": "integer"
}Array of Strings
json
{
"title": "A list of strings",
"type": "array",
"items": {
"type": "string",
"default": "bazinga"
}
}Array with Constraints
json
{
"type": "array",
"minItems": 2,
"maxItems": 3,
"items": {
"type": "integer"
}
}Object Component
json
{
"title": "Null field example",
"description": "A short form with a null field",
"type": "object",
"required": ["firstName"],
"properties": {
"helpText": {
"title": "A null field",
"description": "Null fields like this are great for adding extra information",
"type": "null"
},
"firstName": {
"type": "string",
"title": "A regular string field",
"default": "Chuck"
}
}
}Nested Array of Arrays
json
{
"type": "array",
"title": "array of array of string",
"items": {
"type": "array",
"items": {
"type": "string",
"default": "bingo"
}
}
}Example Request:
bash
curl -X POST "https://access.flatnode.io/api/v1/component" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"title": "A single string",
"type": "string"
}'Response: 201 Created
json
{
"data": {
"Id": 456
}
}Get a Component
Retrieve a component by ID.
Endpoint: GET /api/v1/component/{id}
Example Request:
bash
curl -X GET "https://access.flatnode.io/api/v1/component/456" \
-H "Authorization: Bearer your-token-here"Response: 200 OK
Returns the component schema and metadata.
Update a Component
Update an existing component.
Endpoint: PATCH /api/v1/component/{id} or PUT /api/v1/component/{id}
Request Body:
json
{
"title": "Updated Component Title",
"type": "string"
}Example Request:
bash
curl -X PATCH "https://access.flatnode.io/api/v1/component/456" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Title",
"type": "string"
}'Response: 200 OK
Delete a Component
Delete a component.
Endpoint: DELETE /api/v1/component/{id}
Example Request:
bash
curl -X DELETE "https://access.flatnode.io/api/v1/component/456" \
-H "Authorization: Bearer your-token-here"Response: 200 OK or 204 No Content
Supported JSON Schema Types
The API supports the following JSON Schema types and constraints:
string - Text values
minLength,maxLengthpattern- Regular expression patternenum- Allowed valuesformat- Format validation (e.g.,date-time,email,uri)
integer - Whole numbers
minimum,maximumexclusiveMinimum,exclusiveMaximummultipleOf
number - Decimal numbers
- Same constraints as integer
boolean - True/false values
array - Lists of items
items- Schema for array items (required)minItems,maxItemsuniqueItems
object - Key-value pairs
properties- Property definitionsrequired- Array of required property namesadditionalProperties- Allow/disallow extra propertiesminProperties,maxProperties
null - Null values
Schema Validation Rules
- Arrays must have an
itemsdefinition (empty arrays without item type are not supported) - Objects can restrict additional properties with
additionalProperties: false - Required fields are enforced when creating content
- Min/max constraints are validated
anyOfis supported, but payloads must match exactly one schema (zero or multiple matches are rejected)
Current Limitations (Not Yet Implemented)
The following JSON Schema features are not yet supported by the API:
allOf,oneOf,not,constif,then,elsetypeas an array (union types)- Object keywords:
patternProperties,propertyNames,dependencies
Note: integer-specific bounds (minimum, maximum, exclusiveMinimum, exclusiveMaximum) are not fully implemented yet.