File ingestion
Less than to read
The file ingestion API allows 3rd party application to upload file to X3. The uploaded file will be scanned for any security threat and stored on the corresponding X3 storage. Only text files are allowed and their size cannot exceed 350 MB.
-
Requirements for this step:
-
Url of API to call: in our example, it will be https://api.customerregion-sagex3.com/v1/dataingestion/SEED/
-
A valid access token “XXXXXXX” for this endpoint obtained as shown in the previous step Token management
-
-
Important note: This functionality has 2 steps:
-
Obtain a signed upload url
-
Upload the file using the presigned URL obtained previously
-
-
API call examples:
-
By curl command:
-
Obtain a signed upload url
curl -X POST -LH "Authorization: Bearer XXXXXXX" https://api.customerregion-sagex3.com/v1/dataingestion/SEED?filename=testdemo.txt
Result:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1032 100 1032 0 0 710 0 0:00:01 0:00:01 --:--:-- 710 {"uploadUrl":"signed upload url", "trackingUrl":"tracking url"}
or
//status code 400 { "message": "Missing required request parameters filename" } //status code 403 { "message": "File already exists" }
-
Upload the file using the presigned URL obtained previously
curl -v --upload-file <sourcefile> “<signed upload url>”
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ... * TCP_NODELAY set 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* .... * SSL certificate verify ok. } [5 bytes data] > PUT ..... > Content-Length: 1588 > Expect: 100-continue > { [5 bytes data] < HTTP/1.1 100 Continue } [5 bytes data] * We are completely uploaded and fine { [5 bytes data] < HTTP/1.1 200 OK < x-amz-id-2: cqYfTc97mLDyUljyA1xkw5msvBNE0380i/G0IR93TVkFFzeAfmmlwStTH/UtunHv6KG/I4hoXLk= < x-amz-request-id: 98EFF82D2682D4B4 < Date: Fri, 25 Jan 2019 00:38:53 GMT < x-amz-server-side-encryption: AES256 < ETag: "aaa32fcc92b3d705b3835d76eeacb28c" < Content-Length: 0 < Server: AmazonS3 < 100 1588 0 0 100 1588 0 1373 0:00:01 0:00:01 --:--:-- 1373
-
-
By Postman (for demo purpose, region ‘qa’ is used)
-
Obtain a signed upload url
-
Upload the file using the presigned URL obtained previously
-
-