/jobs/{jobID} (POST)

Inserts data for an import job and returns rows that haven’t passed validation.

This endpoint also allows you to specify a mapping, as with the job creation. When that’s the case, the mapping takes precedence over any mapping saved on the job, and is used for the request.

It’s also possible to specify a default value for columns, which is inserted if nothing is specified in the supplied data. On top of this, the service automatically inserts a default value of “public.Actual” for Version if none is specified.

The data to import is specified in the Data property. Make sure the rows passed don’t have more columns than in the model, or they rows will be rejected. Primary keys (dimensions) are also mandatory, unless you have specified some default value.

The service also supports posting data via CSV. In this case, set the header Content-type to text/csv. An example for this type of request is shown below. If you want to have a delimiter other than the default ",", you can include the optional “delimiter” parameter in the URL, also described below.

API Request Details

URL

{BaseURL}/jobs/{jobID}

Request Type

POST

Request Content

application/json

Required Header

Name

x-csrf-token

Value

<token>

Additional Parameters

  • delimiter: optional parameter to specify a custom delimiter when the content-type header is set to text/csv.

Sample Request

https://your-sac-tenant-url.cloud/api/v1/dataimport/jobs/jobA
{ 
   "Mapping":{ 
      "Bicycle":"Bike" 
   }, 
   "DefaultValues":{ 
      "Shop":"SHP_01" 
   }, 
   "Data":[ 
      { 
         "Version":"public.Budget", 
         "Date":"202301", 
         "Bike":"TX100", 
         "Quantity":200 
      }, 
      { 
         "Date":"202301", 
         "Bike":"AB100", 
         "Quantity":100 
      } 
   ] 
} 

Text/csv post data request

Version,Date,Bicycle,Shop,QuantitySold,TotalEarnings 
public.Actual,202303,TX100,SHP_01,100,1234.56 
public.Actual,202304,TX101,SHP_02,200,10.00 

Deleted data for currency conversion and unit conversion imports

Currency conversion related jobs offer an additional functionality that allows you to delete records from the target table before running the import. This functionality is not supported for import to models.

You can send records to delete from the target currency conversion table, following the same format as Data property in this body. Mapping and default values are supported and will follow the same rules as the Data section. Requests with only DeletedData section are not allowed. The Data section is always mandatory.

Regarding unit conversion, only the primary keys of the rows to be deleted need to be specified. Specifying any further column has no effects on the delete.

{ 
  "DefaultValues":{ 
      "toCurr":"EUR" 
   }, 
   "Data":[ 
      { 
         …, 
         "fromCurr":"GBP", 
         "rateValue":"0.86914", 
         "validFromDate": "20230101" 
      }      
  ], 
   "DeletedData”: [ 
 { 
        …, 
         "fromCurr":"CAD", 
         "rateValue":"1.45", 
         "validFromDate": "20221231" 
      } 
]} 

The body above will first delete the row CAD-EUR from the target table and then import GBP-EUR with exchange rate 0.86914 valid from the 1st January 2023.

Numeric Shift

When importing to public account dimensions, the numericShift property, which corresponds to Scale in SAP Analytics Cloud, is stored as a numeric value. You must use the numeric values when importing to this column. The values are mapped as follows:
  • 0 is mapped to ‘None’

  • 2 is mapped to ‘Percent’

  • -3 is mapped to ‘Thousand’

  • -6 is mapped to ‘Million’

  • -9 is mapped to 'Billion"

In the example below, the numericShift value is set to 'Thousand':
{ 
"ID":"ACC_100", 
"accType":"AST", 
"rateType":"Closing", 
"Description":"Account_100", 
"numericShift":"Thousand", 
} 
But should be set to '-3':
{ 
"ID":"ACC_100", 
"accType":"AST", 
"rateType":"Closing", 
"Description":"Account_100", 
"numericShift":-3, 
} 

Data Overwrite

When importing data to public dimensions, any column that is either omitted, missing or set to null will be deleted and overwritten.

ID

Description

Location

Product

IT_100

Item_100

New York

Coffee

POST Body

{ 
   "Data": [ 
		{ 
		"ID": "IT _100", 
		"Description" : "Item_100_Updated",  
		} 
           ] 
} 

Location and Product are omitted and their values are removed.

ID

Description

Location

Product

IT_100

Item_100_Updated

   
{ 
	"Data": [ 
		{ 
		"ID": "IT _100", 
		"Description" : "Item_100_Updated",
		"Location" : "New York",
		"Product" : "Product", 
		} 
           ] 
} 

ID

Description

Location

Product

IT_100

Item_100_Updated

New York

Coffee

Sample Response

201: Created

POST call with a valid row, and an invalid row:

{ 
   "totalNumberRowsInCurrentRequest":2, 
   "upsertedNumberRows":1, 
   "failedNumberRows":1, 
   "failedRows":[ 
      { 
         "row":{ 
            "Version":"public.Actual", 
            "Date":"202301", 
            "Bike":"InvalidBikeName", 
            "Shop_Tienda":"SHP_01", 
            "Quantity":100, 
            "TotalEarnings":1234.56 
         }, 
         "reason":"Row has more column(s) than expected, Row is missing values for primary key(s) - Bicycle" 
      } 
   ], 
   "validateJobURL": "{BaseURL}/jobs/{jobID}/validate", 
   "runJobURL":"{BaseURL}/jobs/{jobID}/run ", 
   "totalNumberRowsInJob":"1" 
} 

It is important to clarify that only valid rows are persisted in the temporary storage. All invalid rows aren't persisted. In this example, two rows were sent, but only one is now persisted.

POST call with two valid rows:
{ 
   "totalNumberRowsInCurrentRequest":2, 
   "upsertedNumberRows":2, 
   "failedNumberRows":0, 
   "failedRows":[], 
   "validateJobURL": "{BaseURL}/jobs/{jobID}/validate", 
   "runJobURL":"{BaseURL}/jobs/{jobID}/run ", 
   "totalNumberRowsInJob":"2" 
} 
POST call with 2 rows to delete and 1 to import:
{ 				
"totalNumberDeletedRowsInCurrentRequest":2, 
"failedDeletedDataNumberRows":0, 
"failedDeletedDataRows":[], 
"totalNumberRowsInCurrentRequest":1, 
"upsertedNumberRows":1, 
"failedNumberRows":0, 	
"failedRows":[], 
"validateJobURL": "{BaseURL}/jobs/{jobID}/validate", 				
"runJobURL":"{BaseURL}/jobs/{jobID}/run ", 
"totalNumberRowsInJob":"1" 
} 
Both rows to be deleted are stored in the temporary storage. The single row to be imported is also stored in the temporary storage.

Sample Request (T006 - conversionRates)

The request below creates a new ABC unit, while deleting another XYZ unit. Note that ABC is a base unit of measure, for the DIM01 group. This means that a new group will be created in the T006D table (Unit Groups). For the import to succeed, the PRIMARY column must be set to "X", and ZAEHL (Numerator), and NENNR (Denominator) must both be set to "1".
{ 
  "Data": [ 
    { 
      "MSEHI": "ABC", 
      "KZEX3": "X", 
      "KZEX6": "Y", 
      "ANDEC": 5, 
      "KZKEH": "Z", 
      "KZWOB": "W", 
      "KZ1EH": "1", 
      "KZ2EH": "2", 
      "DIMID": "DIM01", 
      "ZAEHL": 1, 
      "NENNR": 1, 
      "EXP10": 3, 
      "ADDKO": 12345.6789, 
      "EXPON": 2, 
      "DECAN": 8, 
      "ISOCODE": "ISO", 
      "PRIMARY": "X", 
      "TEMP_VALUE": 9876.54321, 
      "TEMP_UNIT": "C", 
      "FAMUNIT": "F", 
      "PRESS_VAL": 2112.34567, 
      "PRESS_UNIT": "BAR" 
    } 
  ], 
"DeletedData": [ 
    { 
    "MSEHI": "XYZ" 
    } 
  ] 
} 

Sample Request (T006A – unitDescriptions)

The request below is a sample request creating descriptions in English for the ABC unit, and deleting the English descriptions for the XYZ unit.
{ 
    "Data": [ 
        { 
            "SPRAS": "en", 
            "MSEHI": "ABC", 
            "MSEHT": "Unit A", 
            "MSEHL": "Unit ABC"
        } 
    ], 
    "DeletedData": [ 
        { 
            "SPRAS": "en", 
            "MSEHI": "XYZ" 
        } 
    ] 
} 

Sample Request (DeletedData – DeleteAndUpsert import method)

The request below specifies the data to delete when using the DeleteAndUpsert import method.

{ 
    "Mapping": { 
        "rateValue": "rateV" 
    }, 
    "Data": [ 
        { 
            "category": "", 
            "rateType": "", 
            "rateVersion": "", 
            "fromCurr": "EUR", 
            "toCurr": "GBP", 
            "validFromDate": "2023-05-23", 
            "rateV": 0.86914 
        }, 
        { 
            "category": "", 
            "rateType": "", 
            "rateVersion": "", 
            "fromCurr": "EUR", 
            "toCurr": "CAD", 
            "validFromDate": "2023-05-24", 
            "rateV": 1.4593 
        } 
    ], 
    "DeletedData": [ 
         { 
            "category": "", 
            "rateType": "", 
            "rateVersion": "", 
            "fromCurr": "EUR", 
            "toCurr": "USD", 
            "validFromDate": "2023-05-15", 
            "rateV": 2 
        } 
    ] 
} 

Error Responses

HTTP Status Code

Returns

400

Bad Request

403

Unauthorized

404

Not Found

500

Unexpected Error