You can upload data to repositories in which the Timeline API data source is enabled. For example, you have separate data managers whose tasks are only to upload tables to Timeline repositories for further processing, and they need neither access to other features of the program, nor any other specific actions in Timeline interface. In this case, they can do it through a series of Timeline endpoint calls.
Note. For information on where to find path parameter values for the endpoints, see Repository path parameters.
Before you begin
Make sure that the target table is created in the needed repository.
Important. At the moment, it is impossible to create a new table using API requests.
You may want to obtain some information about available repositories and tables in them, or create a completely new repository:
- Send a GET request to obtain the list of available repositories, where the Timeline API data source is enabled.
Endpoint:
{your.timeline.instance}.com/api/ext/1.0/repository
In response, you will receive a list of available repositories, from which you can copy the ID of the needed one.
Show CURL example
To use this command on Windows, change ' to ".
Important. CURL is not available on Windows by default, you will need to install it separately to use these commands.
Request:
Response:
- Send a GET request to obtain the list of tables existing in the repository.
Endpoint:
{your.timeline.instance}.com/api/ext/1.0/repository/{repositoryId}/table
Required parameters: repositoryId
In response, you will receive a list of tables available to you in this repository. You can copy the ID of the needed table from this list.
Show CURL example
To use this command on Windows, change ' to ".
Important. CURL is not available on Windows by default, you will need to install it separately to use these commands.
Request:
Response:
- Send a POST request to create a new repository with Timeline API data source enabled. Provide the name for the new repository in the request body.
Endpoint:
{your.timeline.instance}.com/api/ext/1.0/repository
Request body example:
In response, you will receive:
- id - the identifier of the new repository.
- name - the name of the new repository.
- role - your role in the new repository. Then creating a repository, you obtain the Owner role in it by default.
Show CURL example
To use this command on Windows, change ' to ".
Important. CURL is not available on Windows by default, you will need to install it separately to use these commands.
Request:
Response:
Uploading data
- Send a POST request to generate and retrieve an upload URL to transmit a file. Endpoint:
{your.timeline.instance}.com/api/ext/1.0/repository/{repositoryId}/file/upload-url
Required parameters: repositoryId
Request body example:
In response, you will get a URL that will be a temporary storage for uploaded files. The files will be loaded to Timeline from this storage.
Also, copy the key and value of the response header:
- Send a PUT request to the URL generated in the previous step to upload the file there. Include the headers received along with the URL and provide the raw file data as the request body.
- After the upload is finished, send a POST request to trigger final processing on the uploaded file and load it into the target repository. Provide the file key received in the previous step in the request body.
Endpoint:
{your.timeline.instance}.com/api/ext/1.0/repository/{repositoryId}/load
Required parameters: repositoryId
Request body example:
You will receive a processingId in response.
- Send a GET request with the processingId returned by the previous request. Endpoint:
{your.timeline.instance}.com/api/ext/1.0/processing/{processingId}
Poll the processing endpoint until the status becomes FINISHED.
As a result, the file will be loaded, and a new table with the specified name will be created in the specified repository.
Note. If a table with the provided name already exists, all data from that table will be deleted and overwritten by the new data.
Examples
For Windows
Important. CURL is not available on Windows by default, you will need to install it separately to use these commands.
- Request:
curl --location -- request POST "https://online.timelinepi.com/api/ext/1.0/repository/1404/file/upload-url" --header "Content-Type: application/json" --header "Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==" --data "{\"fileName\": \"sample-file.csv\"}"
Response:
{
"url": "https://online.timelinepi.com/timelinepi-repositories-onlinepi/etl/repository/1404/1691430097566/sample-file.csv?Expires=1691431297&Key-Pair-Id=APKAJJOKFFMHWCD6WJ7Q&Signature=lLIoOV54bveuK6fopne~EaokeLzzRtes1lC-jp4m5rk32LPirIhn0Lht2FaH3~NGYxWiBCGUJyimk5LvhWTURaDWMX85ze6JJgBPSmYSn~CAPiQWBz6VLQbWEGIsUBTLxI2Ungwn2U3FHx~8Z~I4gh5SIVBThsJK0-jOzLQ9SKlXbuQCPdDOi3fFIVEGH2hZ95XR98fl-1zHhPUJFVMeoYTAve2iphyr1XRT2jy2n1a0AMaLJmI18kxxKFY7K954aDYxxpFEbRzcIPuLW6MOm7TE8kCG3~vLsXVBu5vzQodjZAY~uuLl5kImdDjH1wqk6~V1rxjgmWdP37CKgm5fwQ__"
"key": "repository/1404/1691430097566/sample-file.csv",
"headers": {
"x-amz-acl": "bucket-owner-full-control"
}
}
- Request:
curl --location --request PUT "https://online.timelinepi.com/timelinepi-repositories-onlenepi/etl/repository/1404/1691430097566/sample-file.csv?Expires=1691431297&Key-Pair-Id=APKAJJOKFFMHWCD6WJ7Q&Signature=lLIoOV54bveuK6fopne~EaokeLzzRtes1lC-jp4m5rk32LPirIhn0Lht2FaH3~NGYxWiBCGUJyimk5LvhWTURaDWMX85ze6JJgBPSmYSn~CAPiQWBz6VLQbWEGIsUBTLxI2Ungwn2U3FHx~8Z~I4gh5SIVBThsJK0-jOzLQ9SKlXbuQCPdDOi3fFIVEGH2hZ95XR98fl-1zHhPUJFVMeoYTAve2iphyr1XRT2jy2n1a0AMaLJmI18kxxKFY7K954aDYxxpFEbRzcIPuLW6MOm7TE8kCG3~vLsXVBu5vzQodjZAY~uuLl5kImdDjH1wqk6~V1rxjgmWdP37CKgm5fwQ__" --header "x-amz-acl: bucket-owner-full-control" --header "Content-Type: text/csv" --header "Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==" --data "%PATH_TO_FILE_DIRECTORY%sample-file.csv"
Response:
Empty response
- Request:
curl --location --request POST "https://online.timelinepi.com/api/ext/1.0/repository/1404/load" --header "Content-Type: application/json" --header "Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==" --data "{\"fileKeys\": [\"repository/1404/1691430097566/sample-file.csv\"],\"tableName\": \"data_sample\"}"
Response:
{
"processingId": "IUmSlSLFRfnyiYj4hvYWpw"
}
- Request:
curl --location "https://online.timelinepi.com/api/ext/1.0/processing/IUmSlSLFRfnyiYj4hvYWpw" --header "Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA=="
Response:
{
"id": "IUmSlSLFRfnyiYj4hvYWpw",
"status": "FINISHED",
"subResults": [
{
"type": "S3_MIGRATION",
"status": "FINISHED"
}
]
}
For Linux
- Request:
curl --location 'https://online.timelinepi.com/api/ext/1.0/repository/1404/file/upload-url' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==' \
--data '{
"fileName": "sample-file.csv"
}'
Response:
{
"url": "https://online.timelinepi.com/timelinepi-repositories-onlinepi/etl/repository/1404/1691430097566/sample-file.csv?Expires=1691431297&Key-Pair-Id=APKAJJOKFFMHWCD6WJ7Q&Signature=lLIoOV54bveuK6fopne~EaokeLzzRtes1lC-jp4m5rk32LPirIhn0Lht2FaH3~NGYxWiBCGUJyimk5LvhWTURaDWMX85ze6JJgBPSmYSn~CAPiQWBz6VLQbWEGIsUBTLxI2Ungwn2U3FHx~8Z~I4gh5SIVBThsJK0-jOzLQ9SKlXbuQCPdDOi3fFIVEGH2hZ95XR98fl-1zHhPUJFVMeoYTAve2iphyr1XRT2jy2n1a0AMaLJmI18kxxKFY7K954aDYxxpFEbRzcIPuLW6MOm7TE8kCG3~vLsXVBu5vzQodjZAY~uuLl5kImdDjH1wqk6~V1rxjgmWdP37CKgm5fwQ__"
"key": "repository/1404/1691430097566/sample-file.csv",
"headers": {
"x-amz-acl": "bucket-owner-full-control"
}
}
- Request:
curl --location --request PUT 'https://online.timelinepi.com/timelinepi-repositories-onlenepi/etl/repository/1404/1691430097566/sample-file.csv?Expires=1691431297&Key-Pair-Id=APKAJJOKFFMHWCD6WJ7Q&Signature=lLIoOV54bveuK6fopne~EaokeLzzRtes1lC-jp4m5rk32LPirIhn0Lht2FaH3~NGYxWiBCGUJyimk5LvhWTURaDWMX85ze6JJgBPSmYSn~CAPiQWBz6VLQbWEGIsUBTLxI2Ungwn2U3FHx~8Z~I4gh5SIVBThsJK0-jOzLQ9SKlXbuQCPdDOi3fFIVEGH2hZ95XR98fl-1zHhPUJFVMeoYTAve2iphyr1XRT2jy2n1a0AMaLJmI18kxxKFY7K954aDYxxpFEbRzcIPuLW6MOm7TE8kCG3~vLsXVBu5vzQodjZAY~uuLl5kImdDjH1wqk6~V1rxjgmWdP37CKgm5fwQ__' \
--header 'x-amz-acl: bucket-owner-full-control' \
--header 'Content-Type: text/csv' \
--header 'Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==' \
--data '@sample-file.csv'
Response:
Empty response
- Request:
curl --location --request POST 'https://online.timelinepi.com/api/ext/1.0/repository/1404/load' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA==' \
--data '{
"fileKeys": [
"repository/1404/1691430097566/sample-file.csv"
],
"tableName": "data_sample"
}'
Response:
{
"processingId": "IUmSlSLFRfnyiYj4hvYWpw"
}
- Request:
curl --location 'https://online.timelinepi.com/api/ext/1.0/processing/IUmSlSLFRfnyiYj4hvYWpw' \
--header 'Authorization: Bearer b2SampleTokenGY0ZTktOTAyMC00YTg4LTljZWUtMmVkMzBjNzY0NDBmOjhkOWNkYTI2LTRhY2ItNGY5Yy04YWYxLWVjNzJhZDQwNmJhZA=='
Response:
{
"id": "IUmSlSLFRfnyiYj4hvYWpw",
"status": "FINISHED",
"subResults": [
{
"type": "S3_MIGRATION",
"status": "FINISHED"
}
]
}