Upload Files into Catalog
This page shows you how to upload files to a Catalog.
The Catalog supports the following file types: .md, .txt, .pdf, .html , .ppt, .pptx, .doc, .docx, .xls, .xlsx and .csv.
Upload Files to a Catalog via API
export INSTILL_API_TOKEN=********
curl -X POST 'http://localhost:8080/v1alpha/namespaces/NAMESPACE_ID/catalogs/CATALOG_ID/files' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"name": "example-file.pdf",
"type": "FILE_TYPE_PDF",
"content": "base64-encoded-content"
}'from instill.clients import init_artifact_client
artifact = init_artifact_client(api_token="INSTILL_API_TOKEN", url="http://localhost:8080")
artifact.upload_catalog_file(
namespace_id="NAMESPACE_ID",
catalog_id="CATALOG_ID",
file_path="/path/to/example-file.pdf",
)
artifact.close()Note that the NAMESPACE_ID and CATALOG_ID path parameters must be replaced with the Catalog owner's ID (namespace) and the identifier of the Catalog to be updated, respectively.
The type field in the request body specifies the file type, given as a string. The following file types are currently supported:
FILE_TYPE_TEXTFILE_TYPE_PDFFILE_TYPE_MARKDOWNFILE_TYPE_HTMLFILE_TYPE_DOCXFILE_TYPE_DOCFILE_TYPE_PPTFILE_TYPE_PPTXFILE_TYPE_XLSXFILE_TYPE_XLSFILE_TYPE_CSV
The content field in the request body contains the base64-encoded content of the file.
Upload Files to a Catalog via Console
To upload files to a Catalog from Console, follow these steps:
- Launch Console locally at http://localhost:3000.
- Navigate to the Artifacts page using the navigation bar.
- Click the Catalog card you wish to upload files to.
- Select
Upload Documentsin the left panel. - Drag and drop your files into the blue box or click
browse computerto upload files.
Note:
- The upload filename must not be longer than 255 characters. We recommend using a shorter filename (less than 100 characters) to avoid any issues.
Updated 2 months ago