Create an import template
curl --request POST \
--url https://clarus-api.com/api/import_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\\.csv$",
"template_type": "StandardOrder",
"ftp_user_id": 12,
"account_id": 3,
"mapping_group_id": 45
}
}
}
'import requests
url = "https://clarus-api.com/api/import_templates"
payload = { "data": {
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\.csv$",
"template_type": "StandardOrder",
"ftp_user_id": 12,
"account_id": 3,
"mapping_group_id": 45
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'import_templates',
attributes: {
file_regexp: '^ORDERS_.*\.csv$',
template_type: 'StandardOrder',
ftp_user_id: 12,
account_id: 3,
mapping_group_id: 45
}
}
})
};
fetch('https://clarus-api.com/api/import_templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "45",
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\\.csv$",
"template_type": "StandardOrder",
"user_id": 7
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Import Templates
Create an import template
Create an import template defining how files matching a filename pattern are mapped onto a warehouse resource for a given SFTP user.
POST
/
api
/
import_templates
Create an import template
curl --request POST \
--url https://clarus-api.com/api/import_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\\.csv$",
"template_type": "StandardOrder",
"ftp_user_id": 12,
"account_id": 3,
"mapping_group_id": 45
}
}
}
'import requests
url = "https://clarus-api.com/api/import_templates"
payload = { "data": {
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\.csv$",
"template_type": "StandardOrder",
"ftp_user_id": 12,
"account_id": 3,
"mapping_group_id": 45
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'import_templates',
attributes: {
file_regexp: '^ORDERS_.*\.csv$',
template_type: 'StandardOrder',
ftp_user_id: 12,
account_id: 3,
mapping_group_id: 45
}
}
})
};
fetch('https://clarus-api.com/api/import_templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "45",
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\\.csv$",
"template_type": "StandardOrder",
"user_id": 7
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "import_templates",
"attributes": {
"file_regexp": "^ORDERS_.*\\.csv$",
"template_type": "StandardOrder",
"ftp_user_id": 12,
"account_id": 3,
"mapping_group_id": 45
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
file_regexp | Yes | Regexp matched against incoming filenames |
ftp_user_id | Yes | SFTP user whose uploads this template processes |
template_type | No | One of the supported template types (see enum) |
account_id | No | Stock account the data belongs to |
mapping_group_id | No | MappingGroup (must have operation_type = ftp) |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Created successfully
Show child attributes
Show child attributes
⌘I

