/api/import/:id

Posts data to BellaDati in JSON format.

This endpoint is designed to consume larger amounts of data. If you want to insert single records (record by record), use POST Form Data endpoint instead.

Resource Information

Request Parameters

Parameters

Detail

Example

id

ID of the data set. You can find the ID in the response to /api/dataSets

123

file

JSON file containing data content to submit with following structure:

NameDescription
overwrite

(Optional) Action description to perform with existing data. If this element is not specified then existing data remains unchanged and new data rows will be appended.

NameDescription
policyOverwrite action to perform with existing data - please see list of supported values.
dateAttribute(Optional) Code of attribute that should be used for date compare.
dateFrom(Optional) Date specifying start date of data rows to overwrite. Format: "yyyy-MM-dd"
dateTo(Optional) Date specifying end date of data rows to overwrite. Format: "yyyy-MM-dd"
attributesAllBoolean flag indicating if data in for attributes should be overwritten.
attributes(Optional) Array containing codes of attributes that should be overwritten.


columns

Array containing column definition in following structure:

NameDescription
codeColumn code (attribute or indicator)
format(Optional) Format pattern for date attribute, time attribute, datetime attribute or indicator.
dataArray containing data rows where each data row is represented as nested array.
{  
  "overwrite": { 
	"policy": "DELETE_ALL", 
  	"dateAttribute": "L_MY_DATE",
	"dateFrom": "2014-12-01", 
  	"dateTo": "2014-12-31",  
  	"attributesAll": false,
  	"overwriteAttributes": [ "L_ID", "L_MY_DATE" ] 
  },
  "columns" : [ 
    { 
      "code" : "L_COUNTRY_OR_AREA" 
    }, 
    { 
      "code" : "L_MY_DATE", 
      "format" : "yyyy-MM-dd" 
    }, 
    { 
      "code" : "L_MY_TIME", 
      "format" : "HH:mm:ss.SSS" 
    }, 
    { 
      "code" : "L_MY_DATETIME", 
      "format" : "yyyy-MM-dd HH:mm:ss.SSS" 
    },
    { 
      "code" : "M_REVENUE" 
    }
  ],
  "data" : [ 
    [ 
      "Country or Area 1", 
      "2015-12-01", 
      "22:33:44.555", 
      "2015-12-01 22:33:44.555",
      "10000" 
    ], 
    [ 
      "Country or Area 2", 
      "2015-12-02", 
      "16:27:38.123", 
      "2015-12-02 16:27:38.123",
      "23456"
    ] 
  ] 
}

Sample Request / Response

Using curl:

curl -H "Authorization: OAuth realm=\"https://service.belladati.com/\", oauth_consumer_key=\"myConsumer\", oauth_token=\"mh7an9dkrg59\", oauth_timestamp=\"135131231\", oauth_nonce=\"randomString\"" -H "Content-Type: application/octet-stream" --data-binary @MyDataFile.json https://service.belladati.com/api/import/123

When the file has been submitted successfully, the server replies with an HTTP status code of 200 and the content contains import ID:

Import id=456 started
  • No labels