Data Factory File API
Introduction
A Data Factory File is a file generated by a Data Factory task. Or a file used as an input by a Data Factory task.
Each endpoint of this API is available in two versions:
- V2 returns the full File object, exposing rich file metadata such as checksums, size, MIME type and image dimensions. We recommend using this version for new integrations.
- V1 is deprecated. It remains available to ensure compatibility with existing integrations, and returns only the identifier, the name and the download url of the file.
Both versions are documented together below: each endpoint provides a V2 and a V1 tab for its request and response examples.
The Data Factory Files API Swagger definition is available on our Product-Live API portal here.
General information
- Maximum file size is set to 100MB. If you need to upload larger files, please contact our support team.
- A Data Factory file has a limited lifetime. It is automatically deleted after 90 days.
- Rate limit: 100 requests per minute
- To download a file, request the
urlreturned by the API with your API key. This URL responds with an HTTP redirect to the file content: make sure your HTTP client follows redirects (most clients do by default).
The File object
The V2 endpoints represent a file as a single file object. The same object is embedded in the IMAGE and ATTACHMENT field values returned by the V2 endpoints of the Items, Publications and Suggestions APIs.
| Field | Type | Description |
|---|---|---|
| object | string | Always file |
| id | string | The unique identifier of the file |
| hash | string | The SHA-256 hash of the file content |
| url | string | The URL to download the file content |
| filename | string | The name of the file |
| extension | string | The extension of the file |
| sha256 | string | The SHA-256 checksum of the file content |
| md5 | string | The MD5 checksum of the file content |
| size | number | The size of the file, in bytes |
| sizeKiloBytes | number | The size of the file, in kilobytes |
| mimeType | string | The MIME type of the file |
| imageWidthPixel | number | The width of the image, in pixels. Only present for images |
| imageHeightPixel | number | The height of the image, in pixels. Only present for images |
| createdAt | string | The creation date of the file |
| updatedAt | string | The last update date of the file |
Optional fields are omitted when the corresponding metadata is not available. createdAt and updatedAt are only returned by the Data Factory Files API endpoints: they are not present when the file object is embedded in items, publications or suggestions field values.
Upload a Data Factory File
TIP
- File size limit: 100MB
Request URL
V2
V1
Path parameters
None
Request parameters
None
Request Headers
| Header | Type | Description |
|---|---|---|
| Content-Type | string | multipart/form-data |
| accept | string | application/json |
| X-Api-Key | string | Your account API key |
Request Body
| Body | Type | Description |
|---|---|---|
| form-data | file | A file, sent in the file form field |
Request Example
bash
curl -X 'POST' \
'https://api.product-live.com/v2/data_factory/files' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@table-import-schema.xml'1
2
3
4
5
6
2
3
4
5
6
bash
curl -X 'POST' \
'https://api.product-live.com/v1/data_factory/files' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@table-import-schema.xml'1
2
3
4
5
6
2
3
4
5
6
ts
import { createConfiguration, ServerConfiguration, DataFactoryFileApi } from '@product-live/api-sdk';
import { promises as fs } from 'fs';
import path from 'path';
export async function main(): Promise<void> {
const filePath = 'file path';
const configuration = createConfiguration({
baseServer: new ServerConfiguration(process.env.API_BASE_PATH || '', {}),
authMethods: {
ApiKeyAuthHeader: process.env.API_ACCESS_TOKEN
}
});
const dataFactoryFileApi = new DataFactoryFileApi(configuration);
await dataFactoryFileApi.uploadFile({
data: Buffer.from(await fs.readFile(filePath, 'utf-8')),
name: path.basename(filePath)
});
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
json
{
"name": "protocol-http-perform",
"taskReferenceName": "register_file",
"description": "File upload",
"optional": false,
"type": "SUB_WORKFLOW",
"inputParameters": {
"domain": "api.product-live.com",
"scheme": "HTTPS",
"path": "/v2/data_factory/files",
"method": "POST",
"connectionTimeOutMilliseconds": 300000,
"headers": {
"X-Api-Key": "${workflow.variable.api_key}",
"Accept": "application/json",
"Content-Type": "multipart/form-data"
},
"body": {
"type": "MULTIPART_FORM",
"form": [
{
"name": "file",
"type": "FILE",
"file": "${items.output.file}"
}
]
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Response Example
json
{
"object": "file",
"id": "1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9",
"hash": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"url": "https://api.product-live.com/v2/data_factory/files/1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9/content",
"filename": "table-import-schema.xml",
"extension": "xml",
"sha256": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"md5": "0123456789abcdef0123456789abcdef",
"size": 627,
"sizeKiloBytes": 1,
"mimeType": "application/xml",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-01T12:00:00.000Z"
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
json
{
"object": "data_factory_file",
"id": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-01T12:00:00.000Z",
"url": "http://api.product-live.com/v1/data_factory/files/70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be/content",
"filename": "table-import-schema.xml"
}1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Get a Data Factory File by Id
Request URL
V2
V1
Path parameters
| Parameter | Type | Description |
|---|---|---|
| fileId | string | Required The file identifier, as returned in the id property by the upload and list endpoints of the same version.In V2 it is the id of the file, in V1 it is the SHA-256 hash of the file content. |
Request parameters
None
Request Headers
| Header | Type | Description |
|---|---|---|
| accept | string | application/json |
| X-Api-Key | string | Your account API key |
Request Body
None
Request Example
bash
curl -X 'GET' \
'https://api.product-live.com/v2/data_factory/files/1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>'1
2
3
4
2
3
4
bash
curl -X 'GET' \
'https://api.product-live.com/v1/data_factory/files/70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>'1
2
3
4
2
3
4
ts
import { createConfiguration, ServerConfiguration, DataFactoryFileApi } from '@product-live/api-sdk';
export async function main(): Promise<void> {
const configuration = createConfiguration({
baseServer: new ServerConfiguration(process.env.API_BASE_PATH || '', {}),
authMethods: {
ApiKeyAuthHeader: process.env.API_ACCESS_TOKEN
}
});
const dataFactoryFileApi = new DataFactoryFileApi(configuration);
const dataFactoryFile = await dataFactoryFileApi.getFileById('file id');
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Response Example
json
{
"object": "file",
"id": "1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9",
"hash": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"url": "https://api.product-live.com/v2/data_factory/files/1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9/content",
"filename": "table-import-schema.xml",
"extension": "xml",
"sha256": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"md5": "0123456789abcdef0123456789abcdef",
"size": 627,
"sizeKiloBytes": 1,
"mimeType": "application/xml",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-02T12:00:00.000Z"
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
json
{
"object": "data_factory_file",
"id": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-02T12:00:00.000Z",
"url": "http://api.product-live.com/v1/data_factory/files/70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be/content",
"filename": "table-import-schema.xml"
}1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
List Data Factory Files
Request URL
V2
V1
Path parameters
None
Request parameters
| Parameter | Type | Description |
|---|---|---|
| page | integer | Optional The page number to retrieve. Default value if missing : 0 |
| size | integer | Optional The number of items per page. Default value if missing : 10 |
Request Headers
| Header | Type | Description |
|---|---|---|
| accept | string | application/json |
| X-Api-Key | string | Your account API key |
Request Body
None
Request Example
bash
curl -X 'GET' \
'https://api.product-live.com/v2/data_factory/files?size=10&page=0' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>'1
2
3
4
2
3
4
bash
curl -X 'GET' \
'https://api.product-live.com/v1/data_factory/files?size=10&page=0' \
-H 'accept: application/json' \
-H 'X-Api-Key: <REDACTED>'1
2
3
4
2
3
4
ts
import { createConfiguration, ServerConfiguration, DataFactoryFileApi } from '@product-live/api-sdk';
export async function main(): Promise<void> {
const configuration = createConfiguration({
baseServer: new ServerConfiguration(process.env.API_BASE_PATH || '', {}),
authMethods: {
ApiKeyAuthHeader: process.env.API_ACCESS_TOKEN
}
});
const dataFactoryFileApi = new DataFactoryFileApi(configuration);
const dataFactoryFiles = await dataFactoryFileApi.getFiles()
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Response Example
json
{
"object": "list",
"totalElements": 1,
"data": [
{
"object": "file",
"id": "1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9",
"hash": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"url": "https://api.product-live.com/v2/data_factory/files/1a2b3c4d5e6f70819203a4b5c6d7e8f91a2b3c4d5e6f70819203a4b5c6d7e8f9/content",
"filename": "table-import-schema.xml",
"extension": "xml",
"sha256": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"md5": "0123456789abcdef0123456789abcdef",
"size": 627,
"sizeKiloBytes": 1,
"mimeType": "application/xml",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-02T12:00:00.000Z"
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
json
{
"object": "list",
"totalElements": 1,
"data": [
{
"object": "data_factory_file",
"id": "70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be",
"createdAt": "2020-01-01T12:00:00.000Z",
"updatedAt": "2020-01-02T12:00:00.000Z",
"url": "http://api.product-live.com/v1/data_factory/files/70923562084497906fe165aa6ff2629f2d1e61d39d3e017709f7ac7722ddd2be/content",
"filename": "table-import-schema.xml"
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14