🗄️ Datasources
Add a Datasource
🗄️ Datasources
Add a Datasource
This endpoint creates and stores a Datasource with the provided details.
POST
/
v1
/
datasources
curl -X POST "https://api.getmetal.io/v1/datasources" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data-raw '{
"name": "my_datasource",
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "The band that the uploaded file is about.",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "file",
"autoExtract": true
}'
{
"data": {
"id": "datasourceID",
"createdAt": "2023-08-29T10:51:04.246Z",
"createdBy": "userId",
"name": "my_datasource",
"metadataFields": [
// Extracted field, which we will detect on upload
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
// Normal field, which needs to be manually set on upload
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "File",
"autoExtract": true
}
}
Auth Headers
An API key for your org.
A Client ID for your org.
Body
Name of the Datasource.
Type of the source. File or Text.
Flag indicating whether auto-extraction is enabled. If disabled, it will short-cirtuit to bypass extraction.
An array containing metadata fields. Each object should have name
, type
,
description
, and autoExtract
properties.
curl -X POST "https://api.getmetal.io/v1/datasources" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data-raw '{
"name": "my_datasource",
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "The band that the uploaded file is about.",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "file",
"autoExtract": true
}'
{
"data": {
"id": "datasourceID",
"createdAt": "2023-08-29T10:51:04.246Z",
"createdBy": "userId",
"name": "my_datasource",
"metadataFields": [
// Extracted field, which we will detect on upload
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
// Normal field, which needs to be manually set on upload
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "File",
"autoExtract": true
}
}
curl -X POST "https://api.getmetal.io/v1/datasources" \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data-raw '{
"name": "my_datasource",
"metadataFields": [
{
"name": "band",
"type": "string",
"description": "The band that the uploaded file is about.",
"autoExtract": true
},
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "file",
"autoExtract": true
}'
{
"data": {
"id": "datasourceID",
"createdAt": "2023-08-29T10:51:04.246Z",
"createdBy": "userId",
"name": "my_datasource",
"metadataFields": [
// Extracted field, which we will detect on upload
{
"name": "band",
"type": "string",
"description": "Which heavy metal band is represented by the iconic mascot Eddie?",
"autoExtract": true
},
// Normal field, which needs to be manually set on upload
{
"name": "author",
"type": "string",
"autoExtract": false
}
],
"sourcetype": "File",
"autoExtract": true
}
}