247 lines
8.5 KiB
JSON
247 lines
8.5 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "Budibase API",
|
|
"description": "The public API for Budibase apps and its services.",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://budibase.app/api/public/v1",
|
|
"description": "Budibase Cloud API"
|
|
},
|
|
{
|
|
"url": "{protocol}://{hostname}:10000/api/public/v1",
|
|
"description": "Budibase self hosted API"
|
|
}
|
|
],
|
|
"components": {
|
|
"parameters": {
|
|
"tableId": {
|
|
"in": "path",
|
|
"name": "tableId",
|
|
"required": true,
|
|
"description": "The ID of the table which contains the rows which are being searched for.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"examples": {
|
|
"row": {
|
|
"value": {
|
|
"_id": "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
|
|
"type": "row",
|
|
"tableId": "ta_5b1649e42a5b41dea4ef7742a36a7a70",
|
|
"name": "Mike",
|
|
"age": 30,
|
|
"relationship": [
|
|
{
|
|
"primaryDisplay": "Joe",
|
|
"_id": "ro_ta_..."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"table": {
|
|
"value": {
|
|
"_id": "ta_5b1649e42a5b41dea4ef7742a36a7a70",
|
|
"name": "People",
|
|
"schema": {
|
|
"name": {
|
|
"type": "string",
|
|
"name": "name"
|
|
},
|
|
"age": {
|
|
"type": "number",
|
|
"name": "age"
|
|
},
|
|
"relationship": {
|
|
"type": "link",
|
|
"name": "relationship",
|
|
"tableId": "ta_...",
|
|
"fieldName": "relatedColumn",
|
|
"relationshipType": "many-to-many"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"paths": {
|
|
"/tables/{tableId}/rows/search": {
|
|
"post": {
|
|
"summary": "Allows searching for rows within a table.",
|
|
"parameters": [
|
|
{
|
|
"$ref": "#/components/parameters/tableId"
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"query": {
|
|
"type": "object",
|
|
"properties": {
|
|
"string": {
|
|
"type": "object",
|
|
"example": {
|
|
"columnName1": "value",
|
|
"columnName2": "value"
|
|
},
|
|
"description": "A map of field name to the string to search for, this will look for rows that have a value starting with the string value.",
|
|
"additionalProperties": {
|
|
"type": "string",
|
|
"description": "The value to search for in the column."
|
|
}
|
|
},
|
|
"fuzzy": {
|
|
"type": "object",
|
|
"description": "A fuzzy search, only supported by internal tables."
|
|
},
|
|
"range": {
|
|
"type": "object",
|
|
"description": "Searches within a range, the format of this must be columnName -> [low, high]."
|
|
},
|
|
"equal": {
|
|
"type": "object",
|
|
"description": "Searches for rows that have a column value that is exactly the value set."
|
|
},
|
|
"notEqual": {
|
|
"type": "object",
|
|
"description": "Searches for any row which does not contain the specified column value."
|
|
},
|
|
"empty": {
|
|
"type": "object",
|
|
"description": "Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value."
|
|
},
|
|
"notEmpty": {
|
|
"type": "object",
|
|
"description": "Searches for rows which have the specified column."
|
|
},
|
|
"oneOf": {
|
|
"type": "object",
|
|
"description": "Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]."
|
|
}
|
|
}
|
|
},
|
|
"paginate": {
|
|
"type": "boolean",
|
|
"description": "Enables pagination, by default this is disabled."
|
|
},
|
|
"bookmark": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
],
|
|
"description": "If retrieving another page, the bookmark from the previous request must be supplied."
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"description": "The maximum number of rows to return, useful when paginating, for internal tables this will be limited to 1000, for SQL tables it will be 5000."
|
|
},
|
|
"sort": {
|
|
"type": "object",
|
|
"description": "A set of parameters describing the sort behaviour of the search.",
|
|
"properties": {
|
|
"order": {
|
|
"type": "string",
|
|
"enum": [
|
|
"ascending",
|
|
"descending"
|
|
],
|
|
"description": "The order of the sort, by default this is ascending."
|
|
},
|
|
"column": {
|
|
"type": "string",
|
|
"description": "The name of the column by which the rows will be sorted."
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"enum": [
|
|
"string",
|
|
"number"
|
|
],
|
|
"description": "Defines whether the column should be treated as a string or as numbers when sorting."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "The response will contain an array of rows that match the search parameters.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"rows": {
|
|
"description": "An array of rows, these will each contain an _id field which can be used to update or delete them.",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"example": {
|
|
"$ref": "#/components/examples/row"
|
|
}
|
|
}
|
|
},
|
|
"bookmark": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
],
|
|
"description": "If pagination in use, this should be provided"
|
|
},
|
|
"hasNextPage": {
|
|
"description": "If pagination in use, this will determine if there is another page to fetch.",
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/tables/{tableId}/rows": {
|
|
"post": {
|
|
"summary": "Allows creating a row within a specified table.",
|
|
"parameters": [
|
|
{
|
|
"$ref": "#/components/parameters/tableId"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Returns the created row, including the ID which has been generated for it.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"tags": []
|
|
} |