Import Objects from file

Prev Next

Import Objects from file

Import file endpoint can be used to import data into TeamTracks from a file. The endpoint now uses an async HTTP pattern.

Import file API pattern 

Only xlsx, xls and csv files are supported by the import endpoint

Call

The following POST endpoint should be used.

https://api.team-tracks.com/objectimport/{{RMA_track_ID}}

Here, {{RMA_Track_ID}} is the ID of the track into which the import should be done.

The api should have a role that has access to an add view in the track to be imported into.

The call should include the below headers.

Authorization: "Bearer <token>"
tenant: <your_tenent_ID>
Ocp-Apim-Subscription-Key: <your_subscription_key>

The full cURL is below.

curl --location 'https://api.team-tracks.com/objectimport/{RMA_TrackID}' \
--header 'tenant: {tenant}' \
--header 'Ocp-Apim-Subscription-Key: {Ocp-Apim-Subscription-Key}' \
--header 'Authorization: Bearer {token}' \
--form 'file=@"{filename.xlsx}"'

Response

The api will respond with a jobId as below and the import job will be processed by the application in its background processor.

{
    "jobId": "24786e69-262a-4242-9d65-c15bf89c930e"
}

Querying Job Status

To query the status of an import job, use the following GET endpoint.

https://api.team-tracks.com/job/objectimport/{{jobId}}

Here, {{jobId}} is the the jobId provided by the objectimport endpoint above when the job was scheduled.

The call should include the below headers.

Authorization: "Bearer <token>"
tenant: <your_tenent_ID>
Ocp-Apim-Subscription-Key: <your_subscription_key>

The response is as below. This is the response while the job is in progress.

{
    "finished": false,
    "dateFinished": 0,
    "successfullyCreated": 0,
    "failedToCreate": 0,
    "successfullyUpdated": 0,
    "unchanged": 0,
    "failedToUpdate": 0
}

The response is as below. This is the response while the job is completed.

{
    "finished": true,
    "dateFinished": 1724442508936,
    "successfullyCreated": 4,
    "failedToCreate": 0,
    "successfullyUpdated": 0,
    "unchanged": 0,
    "failedToUpdate": 0,
    "objectsCreated": [
        "bf40c69b-5aaa-4a4b-99f4-69211aa23288",
        "09b04611-9197-4eb2-a75a-69b8eced4020",
        "8775ed19-7515-46db-a672-755748393043",
        "9d16daed-70a7-4077-b100-971571bb39c1",
  ],
    "errors": []
}

dateFinished

Here, the dateFinished in Unix Epoch time, in milliseconds.