File array access
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file/file_id
File array access endpoint allows upload, download and remove of file items.
Expected parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
db_branch_name | The DBBranchName matches the pattern | path | ✅ | string |
table_name | The Table name | path | ✅ | string |
record_id | The Record name | path | ✅ | string |
column_name | The Column name | path | ✅ | string |
file_id | The File Identifier | path | ✅ | string |
Download Content From a File Item in a File Array Column
GEThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file/file_id
Retrieves file content from an array by file ID
Responses
type GetFileItem = void;
type GetFileItem = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type GetFileItem = {
id?: string;
message: string;
};
type GetFileItem = void;
type GetFileItem = void;
Upload or Update the Content of a File Item in a File Array Column
PUThttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file/file_id
Uploads the file content to an array given the file ID
Request Body Type Definition
/**
* @format binary
*/
type PutFileItem = Blob;
Responses
/**
* File metadata
*/
type PutFileItem = {
id?: FileItemID;
name: FileName;
mediaType: MediaType;
/**
* @format int64
*/
size: number;
/**
* @format int64
*/
version: number;
attributes?: Record<string, any>;
};
/**
* Unique file identifier
*
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type FileItemID = string;
/**
* File name
*
* @maxLength 1024
* @minLength 0
* @pattern [0-9a-zA-Z!\-_\.\*'\(\)]*
*/
type FileName = string;
/**
* Media type
*
* @maxLength 255
* @minLength 3
* @pattern ^\w+/[-+.\w]+$
*/
type MediaType = string;
/**
* Xata Table Record Metadata
*/
type Record = RecordMeta & {
[key: string]: any;
};
/**
* Xata Table Record Metadata
*/
type RecordMeta = {
id: RecordID;
xata: {
/**
* The record's version. Can be used for optimistic concurrency control.
*/
version: number;
/**
* The time when the record was created.
*/
createdAt?: string;
/**
* The time when the record was last updated.
*/
updatedAt?: string;
/**
* The record's table name. APIs that return records from multiple tables will set this field accordingly.
*/
table?: string;
/**
* Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
*/
highlight?: {
[key: string]: string[] | {
[key: string]: any;
};
};
/**
* The record's relevancy score. This is returned by the search APIs.
*/
score?: number;
/**
* Encoding/Decoding errors
*/
warnings?: string[];
};
};
/**
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type RecordID = string;
/**
* File metadata
*/
type PutFileItem = {
id?: FileItemID;
name: FileName;
mediaType: MediaType;
/**
* @format int64
*/
size: number;
/**
* @format int64
*/
version: number;
attributes?: Record<string, any>;
};
/**
* Unique file identifier
*
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type FileItemID = string;
/**
* File name
*
* @maxLength 1024
* @minLength 0
* @pattern [0-9a-zA-Z!\-_\.\*'\(\)]*
*/
type FileName = string;
/**
* Media type
*
* @maxLength 255
* @minLength 3
* @pattern ^\w+/[-+.\w]+$
*/
type MediaType = string;
/**
* Xata Table Record Metadata
*/
type Record = RecordMeta & {
[key: string]: any;
};
/**
* Xata Table Record Metadata
*/
type RecordMeta = {
id: RecordID;
xata: {
/**
* The record's version. Can be used for optimistic concurrency control.
*/
version: number;
/**
* The time when the record was created.
*/
createdAt?: string;
/**
* The time when the record was last updated.
*/
updatedAt?: string;
/**
* The record's table name. APIs that return records from multiple tables will set this field accordingly.
*/
table?: string;
/**
* Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
*/
highlight?: {
[key: string]: string[] | {
[key: string]: any;
};
};
/**
* The record's relevancy score. This is returned by the search APIs.
*/
score?: number;
/**
* Encoding/Decoding errors
*/
warnings?: string[];
};
};
/**
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type RecordID = string;
type PutFileItem = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type PutFileItem = {
id?: string;
message: string;
};
type PutFileItem = {
id?: string;
message: string;
};
type PutFileItem = void;
type PutFileItem = void;
Delete an Item From a File Array
DELETEhttps://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file/file_id
Deletes an item from an file array column given the file ID
Responses
/**
* File metadata
*/
type DeleteFileItem = {
id?: FileItemID;
name: FileName;
mediaType: MediaType;
/**
* @format int64
*/
size: number;
/**
* @format int64
*/
version: number;
attributes?: Record<string, any>;
};
/**
* Unique file identifier
*
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type FileItemID = string;
/**
* File name
*
* @maxLength 1024
* @minLength 0
* @pattern [0-9a-zA-Z!\-_\.\*'\(\)]*
*/
type FileName = string;
/**
* Media type
*
* @maxLength 255
* @minLength 3
* @pattern ^\w+/[-+.\w]+$
*/
type MediaType = string;
/**
* Xata Table Record Metadata
*/
type Record = RecordMeta & {
[key: string]: any;
};
/**
* Xata Table Record Metadata
*/
type RecordMeta = {
id: RecordID;
xata: {
/**
* The record's version. Can be used for optimistic concurrency control.
*/
version: number;
/**
* The time when the record was created.
*/
createdAt?: string;
/**
* The time when the record was last updated.
*/
updatedAt?: string;
/**
* The record's table name. APIs that return records from multiple tables will set this field accordingly.
*/
table?: string;
/**
* Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
*/
highlight?: {
[key: string]: string[] | {
[key: string]: any;
};
};
/**
* The record's relevancy score. This is returned by the search APIs.
*/
score?: number;
/**
* Encoding/Decoding errors
*/
warnings?: string[];
};
};
/**
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_-~:]+
*/
type RecordID = string;
type DeleteFileItem = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type DeleteFileItem = {
id?: string;
message: string;
};
type DeleteFileItem = void;
type DeleteFileItem = void;