/models/{modelID} (POST)
Creates a new import job with a given import type specified automatically.
With this endpoint, you can also specify properties that change the behavior of the import job and how you can interact with it, namely the Mapping and JobSettings properties. These properties, when specified at job creation, are persisted, and exist for the lifetime of that job. However, Mapping can be overridden when posting data to the job. The importType, whether that is factData, masterData, masterFactData, or privateFactData is determined based on the Mapping property sent via the request.
JobSettings allows you to fine-tune how the data is combined with the target model based on matches of dimensions.
You can also set the content-type header to text/csv. However, you won't be able to specify the Mapping or JobSettings properties. With .CSV requests, the importType is inferred based on the column names in the header, or first line of the .CSV data.
After the job has been created, the endpoint returns the ID of the job with which you can interact further, as well as a jobURL, which you can use to post data to the job.
API Request Details
|
URL |
{BaseURL}/models/{modelID} |
|
Request Type |
POST |
|
Request Content |
application/json |
|
Required Header |
|
|
Name |
x-csrf-token |
|
Value |
<token> |
Sample Request
https://your-sac-tenant-url.cloud/api/v1/dataimport/models/modelAYou can send multiple body formats via the request:
-
Body with mapping property to rename two columns. In the example below, the import method is set to CleanAndReplace on dimensions Version and Bicycle:
{ "Mapping": { "Bicycle": "Bike", "Shop": "Store" }, "JobSettings": { "importMethod": "CleanAndReplace", "dimensionScope": ["Version", "Bicycle"] } } -
No job settings specified. In the example below, the import method will be set to Update by default. Mapping specified to rename two columns:
{ "Mapping": { "Bicycle": "Bike", "Shop": "Store" } } -
No job settings specified. No mapping specified (empty body):
{ } -
In the example below, the import method set to Append:
{ "JobSettings": { "importMethod": "Append" } } -
Content-type: text/csv
Version,Date,Bicycle,Shop,QuantitySold,TotalEarnings
Sample Response
201: Created
{
"JobID": "{jobID}",
"JobURL": "{BaseURL}/jobs/{jobID}"
}
Error Responses
|
HTTP Status Code |
Returns |
|---|---|
|
400 |
Bad Request |
|
403 |
Unauthorized |
|
404 |
Not Found |
|
500 |
Unexpected Error |