File Download
To download a file, you must first find the id of the file. Using our search API, you can quickly find the file you are looking for.
File Search
Search files within a given group
curl https://api.xsignals.xpansiv.com/file/search?query=groupName%3D<groupName>
Response:
{
"from": 0,
"totalSize": 4,
"files": [
{
"fileName": "file name",
"fileType": "file type [SOURCE|NCSV|DOWNLOADER|DATA_PREP|GDP]",
"groupName": "group name",
"fid": "file id",
"fields": {
"text": "some text",
...
},
"arrivalTime": "2018-01-01T12:00:00",
"owner": "file owner",
"size": 100
},
...
]
}
This endpoint lists all the files found in the given groupName.
NOTE: The query must be urlencoded. i.e. groupName=CBLExchange Data Voluntary Carbon Daily File should be encoded as groupName%3DCBLExchange%20Data%20Voluntary%20Carbon%20Daily%20File
HTTP Request
GET https://api.xsignals.xpansiv.com/file/search?size=<size>&from=<from>&query=<value>
URL Parameters
Parameter | Description |
---|---|
size | |
from | |
query | Value of the metadata field to look for. |
HTTP Response
The response is a JSON object with a list of files. See the right pane.
File Metadata
curl https://api.xsignals.xpansiv.com/file/<fileId>
This endpoint retrieves the metadata of a specific file. Included in the headers you will find a presigned URL to the location of the file's content. This URL is good for one hour.
Example < Location: https://datalake-xpansivprod-ng.s3.amazonaws.com/c651dd45-edf5-461b-8c59-e7dd457932a9?response-content-disposition=attachment%3Bfilename%3DCBL%20Ex......
Using the URL you can simply GET the file.
curl -XGET LocationURL
Alternatively, you can use the File Content endpoint.
HTTP Request
GET https://api.xsignals.xpansiv.com/file/<fileId>
URL Parameters
Parameter | Description |
---|---|
fileId | The ID of the file to retrieve |
HTTP Response
Response
{
"fileName": "file name",
"fileType": "file type [SOURCE|NCSV]",
"groupName": "group name",
"fid": "file id",
"fields": {
"fieldName": "field value"
},
"arrivalTime": "2018-01-01T12:00:00",
"owner": "file owner",
"size": 0
}
A response header contains location with a file content. If file doesn't exist, the response code is 404.
Response Body
- fileName - file name
- fileType - file type [SOURCE, NCSV]
- groupName - group name
- fid - file id
- fields - map with metadata of this file
- arrivalTime - file upload date
- owner - user name which upload file
- size - size in bytes
File Content
Get the files content
curl https://api.xsignals.xpansiv.com/file/<id>/download
This endpoint will download the contents of a given fileId.
HTTP Request
GET https://api.xsignals.xpansiv.com/file/<id>/download
URL Parameters
Parameter | Description |
---|---|
fileId | The ID of the file to download |
HTTP Response
The response is the file's content.
File Search by Metadata
Search files with metadata filed1 = value1 and return first 10 hits:
curl https://api.xsignals.xpansiv.com/file/search?size=10&from=0&query=value1
Response:
{
"from": 0,
"totalSize": 4,
"files": [
{
"fileName": "file name",
"fileType": "file type [SOURCE|NCSV|DOWNLOADER|DATA_PREP|GDP]",
"groupName": "group name",
"fid": "file id",
"fields": {
"text": "some text",
...
},
"arrivalTime": "2018-01-01T12:00:00",
"owner": "file owner",
"size": 100
},
...
]
}
This endpoint executes a search for files with given metadata fields and values.
HTTP Request
GET https://api.xsignals.xpansiv.com/file/search?size=<size>&from=<from>&query=<value>
URL Parameters
Parameter | Description |
---|---|
size | |
from | |
query | Value of the metadata field to look for. |
HTTP Response
The response is a JSON object with a list of files. See the right pane.
File Search By Regexp
Search files with value1 and return first 10 hits:
curl https://api.xsignals.xpansiv.com/file/search/regexp?size=10&from=0&query=value1
-H "Authorization: Bearer yourNgToken"
Response:
{
"from": 0,
"totalSize": 4,
"files": [
{
"fileName": "file name",
"fileType": "file type [SOURCE|NCSV|DOWNLOADER|DATA_PREP|GDP]",
"groupName": "group name",
"fid": "file id",
"fields": {
"text": "some text",
...
},
"arrivalTime": "2018-01-01T12:00:00",
"owner": "file owner",
"size": 100
},
...
]
}
This endpoint executes a search regexp for files with given metadata fields and values.
HTTP Request
GET https://api.xsignals.xpansiv.com/file/search/regexp?size=<size>&from=<from>&query=<value>
URL Parameters
Parameter | Description |
---|---|
size | |
from | |
query | Value of the metadata field to look for. |
HTTP Response
The response is a JSON object with a list of files. See the right pane.