CredentialsBefore starting this section, ensure you have retrieved your API key and the appropriate Sift URL for your provisioned environment.
Instructions on obtaining the API key and URL are available in the authentication section of the documentation.
Import CSVs with cURL
The configuration is a JSON object in the follow format:- POST the configuration to
/api/v2/data-imports:upload. If the request is valid, the endpoint will return an upload URL. - POST the data file to the upload URL. When the request finishes, the data is fully uploaded and will start ingesting.
Example
Data Import from URL
The configuration is a JSON object in the follow format:- POST the configuration to
/api/v2/data-imports:url. If the request is valid, the endpoint will return a 200 response code and begin ingesting the data. - GZIPβd files are supported via the βcontent-encoding: gzipβ response header.
Example
CSV Upload Status
The 200 response from the upload itself only signals that the request to ingest has been submitted properly and does not indicate whether the data is ingested properly. In order to check on the status of the upload, users can either poll General status:CSV Configuration
The CSV configuration is a JSON object in the following format:Time Formats
You can specify the following time formats:Absolute
TIME_FORMAT_ABSOLUTE_RFC3339: Example2023-01-02T15:04:05ZTIME_FORMAT_ABSOLUTE_DATETIMEExample:2023-01-02 15:04:05TIME_FORMAT_ABSOLUTE_UNIX_SECONDS: Seconds since the unix epoch.TIME_FORMAT_ABSOLUTE_UNIX_MILLISECONDS: Milliseconds since the unix epoch.TIME_FORMAT_ABSOLUTE_UNIX_MICROSECONDS: Microseconds since the unix epoch.TIME_FORMAT_ABSOLUTE_UNIX_NANOSECONDS: Nanoseconds since the unix epoch.
Relative
TIME_FORMAT_RELATIVE_NANOSECONDSTIME_FORMAT_RELATIVE_MICROSECONDSTIME_FORMAT_RELATIVE_MILLISECONDSTIME_FORMAT_RELATIVE_SECONDSTIME_FORMAT_RELATIVE_MINUTESTIME_FORMAT_RELATIVE_HOURS
Data Types
You can specify the following data types:CHANNEL_DATA_TYPE_DOUBLE: A double precision floating point number.CHANNEL_DATA_TYPE_FLOAT: A single precision floating point number.CHANNEL_DATA_TYPE_STRING: A string.CHANNEL_DATA_TYPE_BOOL: A boolean.CHANNEL_DATA_TYPE_INT_32: A 32bit signed integer.CHANNEL_DATA_TYPE_INT_64: A 64bit signed integer.CHANNEL_DATA_TYPE_UINT_32: A 32bit unsigned integer.CHANNEL_DATA_TYPE_UINT_64: A 64bit unsigned integer.CHANNEL_DATA_TYPE_ENUM:CHANNEL_DATA_TYPE_BIT_FIELD:
Embedded Configuration
You can also supply the configuration for each column as a JSON encoded object in the CSV file itself. Each column must encode itβs configuration object separately as a CSV string. The configuration can be in either the first or second row of the data. The objects for the time column and data column correspond to thetime_column
and data_columns objects from the CSV configuration.
For example, the time column object will look like this:
Import Data from CSV files using sift-stack-py
Getting started with sift-stack-pyBe sure to visit the Python Quickstart section of the documentation
to see how to get started with the Sift Python client library before continuing.
sample_asset.csv which will have
the following format.
sift-stack-py, we can upload the CSV as is like so: