Import API Classifications by uploading files
This guide includes instructions for importing JSON classification datasets that are larger than 50 MB, or that include a .tsv or .tab file. With this method, a dataset is uploaded as a file with the POST request. Alternatively, your dataset can be imported as a JSON body of the POST request if it is smaller than 50MB. For more information on this alternative, see the Analytics classification APIs guide.
Additionally, using these endpoints requires your global company ID in each request. If you receive the response error message "Cannot find proper global company ID," add the following header to your requests: x-proxy-global-company-id:{GLOBAL_COMPANY_ID}. You can find your global company ID by using the Discovery API.
data-variant=info
data-slots=text
To import an API classification by uploading a file, use the following enpoints:
Each endpoint is used in the following process:
- Create an import job entity with the POST import job by dataset ID endpoint.
- Upload a file using the POST import upload file endpoint.
- Commit your upload using the POST import commit job endpoint.
The endpoints described in this guide are routed through analytics.adobe.io. To use them, you will need to first create a client with access to the Adobe Developer Console. For more information, refer to Getting started with the Analytics API.
POST import job by dataset ID
Use this endpoint to create an import job entity for a classification dataset. Creating an import job entity returns a job ID that can be associated with an uploaded dataset file. The dataset file is uploaded after this API call. For more information on classification jobs, see Classification set jobs manager.
POST https://analytics.adobe.io/api/{GLOBALCOMPANYID}/classifications/job/import/createApiJob/{DATASET_ID}
Request and Response Examples
Click the Request tab in the following example to see a cURL request for this endpoint. Click the Response tab to see a successful JSON response for the request.
data-slots=heading, code
data-repeat=2
data-languages=CURL,JSON
Request
curl -X POST "https://analytics.adobe.io/api/{GLOBALCOMPANYID}/classifications/job/import/createApiJob/6449b63563c1e069c6159415" \
-H "x-api-key: {CLIENT_ID}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-d '{
"dataFormat": "tsv",
"encoding": "UTF8",
"jobName": "testsuite evar1 classifications",
"notifications": [
{
"method": "email",
"state": "completed",
"recipients": [
"john@example.com"
]
}
],
"listDelimiter": ",",
"source": "Direct API Upload",
"keyOptions": {
"byte_length": 0,
"type": "string"
}
}'
Response
{
"api_job_id": "a6fc824c-4d6f-45f9-8f55-456f918e0b41",
"dataset_id": "6449b63563c1e069c6159415",
"ims_org_id": "0DFE76D95967D5B50A494010@AdobeOrg",
"api_job_status": "CREATED",
"job_options": {
"dataFormat": "tsv",
"encoding": "utf8",
"jobName": "testsuite evar1 classifications",
"notifications": [
{
"method": "email",
"state": "completed",
"recipients": [
"john@example.com"
]
}
],
"listDelimiter": ",",
"source": "Direct API Upload",
"keyOptions": {
"byte_length": 255,
"type": "string"
},
"notification_extras": [
{
"key": "Report Suite",
"value": "testsuite"
}
]
}
}
Request example details
The example request above creates an import job with the following specifications:
- The
dataFormatfor the classification astsv. - The
jobNameto betestsuite evar1 classifications. - The notification will be delivered by
emailtojohn@example.comwhen the state iscompleted. - The data source is
Direct API Upload.
Response example details
The example response above shows the following job creation information:
- The
api_job_idisa6fc824c-4d6f-45f9-8f55-456f918e0b41. This ID is necessary to both upload and commit the dataset with the other endpoints in this guide. - The notification details, including its
completedstate.
Request Parameters
The following table describes the POST create job request parameters:
dataFormattsv, tab, or json.encodingUTF-8.jobNamenotificationsmethod, state, and recipients parameters.methodemail and rabbit.statecreated, queued, validated, failed_validation, processing, done_processing, failed_processing, and completed.recipientslistDelimiter, (comma)sourceDirect API Upload.keyOptionsbyte_length, type, and overwrite parametersbyte_lengthtypeoverwritenotification_extraskey, and value parameters.keyvalueResponse Parameters
The following table describes the POST create job response parameters:
api_job_statusdataset_idapi_job_idims_org_idtaxonomist_job_idjob_optionsdataFormat, encoding, jobName, and notifications parameters as shown in the following five rows.dataFormattsv, tab, or json.encodingUTF-8.jobNamenotificationsmethod, state, and recipients parameters.methodemail and rabbit.statecreated, queued, validated, failed_validation, processing, done_processing, failed_processing, and completed.recipientslistDelimiter, (comma)source"Direct API Upload".keyOptionsbyte_length type and overwrite parametersbyte_lengthtypeoverwritenotification_extraskey, and value parameters.keyvaluePOST import upload file
Use this endpoint to upload a file that will be associated with the job ID created with the POST create job endpoint. This file can be tsv, tab, or JSON. For more information on how to structure your classification files, see Classification data files
POST https://analytics.adobe.io.api/{GLOBAL_COMPANY_ID}/classifications/job/import/uploadFile/{API_JOB_ID}
Request and Response Examples
Click the Request tab in the following example to see a cURL request for this endpoint. Click the Response tab to see a successful JSON response for the request.
data-slots=heading, code
data-repeat=2
data-languages=CURL,JSON
Request
curl -X POST "https://analytics.adobe.io.api/{GLOBAL_COMPANY_ID}/classifications/job/import/uploadFile/a6fc824c-4d6f-45f9-8f55-456f918e0b41"
-H "x-api-key: {CLIENT_ID}" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: multipart/form-data" \
-d '{
"Key": "example_file.tsv",
"Value": "/files/examples/example_file.tsv"
}'
Response
{
"api_job_id": "a6fc824c-4d6f-45f9-8f55-456f918e0b41",
"status": "success"
}
Request example details
The example above shows a cURL request with the following:
- The
Keyparameter specified as the file nameexample_file.tsv. - The
Valueparameter specified as the file path/files/examples/example_file.tsv.
Response example details
The example response above shows a successful status for the upload.
Request Parameters
The following table describes the PUT upload file request parameters:
api_job_idKeyValueResponse Parameters
The following table describes the PUT upload file response parameters:
api_job_idstatusPOST import commit job ID
Use this endpoint to commit the changes of a specified job ID. This endpoint finalizes the file uploading process. For more information on classification jobs, see Classification set jobs manager.
POST https://analytics.adobe.io.api/{GLOBAL_COMPANY_ID}/classifications/job/import/commitApiJob/{API_JOB_ID}
Request and Response Examples
Click the Request tab in the following example to see a cURL request for this endpoint. Click the Response tab to see a successful JSON response for the request.
data-slots=heading, code
data-repeat=2
data-languages=CURL,JSON
Request
curl -X POST "https://analytics.adobe.io.api/{GLOBAL_COMPANY_ID}/classifications/job/import/commitApiJob/a6fc824c-4d6f-45f9-8f55-456f918e0b41" \
-H "x-api-key: {CLIENT_ID}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Response
{
"import_job_id": "e11671f1-d352-4b34-bb95-3a26775ef334",
"api_job_id": "a6fc824c-4d6f-45f9-8f55-456f918e0b41"
}
Request example details
The example above shows a cURL request to commit the job associated with the api_job_id of a6fc824c-4d6f-45f9-8f55-456f918e0b41.
Response example details
The example above shows the successful response for committing the job, including the values for import_job_id and api_job_id.
Request Parameters
The following table describes the POST commit job request parameters:
api_job_idResponse Parameters
The following table describes the POST commit job response parameters:
import_job_idapi_job_idAfter importing your classification datasets you can export them to other applications. See the Analytics classification APIs guide for more information.