7. Uploading TLE Data
These are the instructions to authenticate and upload TLE files to the NRAO ODS API.
Contact an NRAO ODS Admin (if you haven’t already) to generate a client for you with appropriate scopes. Coordinate the cadence at which your token will expire with NRAO.
Post your client_id and client_secret as form data to the NRAO ODS API to get your authentication token. You’ll request this token once and reuse it for all API calls until it expires.
curl -X 'POST' \
'https://ods.nrao.edu/token/' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>'
Response 200 OK
{
"token": "<EXAMPLE_TOKEN>"
}
Send your TLE .txt file to the NRAO ODS API using the multipart/form-data content type. You’ll need to include:
Your authentication token in the Authorization header
Your TLE file (a .txt file with TLE records in 3LE format) attached under the field name tle_file
TLE records must be formatted appropriately and a single TLE file must be less than 50 kB.
curl -X 'POST' \
'https://ods.nrao.edu/tle_data' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <EXAMPLE_TOKEN>' \
-H 'Content-Type: multipart/form-data' \
-F 'tle_file=@<EXAMPLE_TEXT_FILE_NAME>.txt;type=text/plain'
Response 201 CREATED
{
"ingested_records": "<number of TLE records sent>"
}
4. When your token expires, you will need to repeat Step 2 using the same client_id and client_secret to get a new token. Your client_id and client_secret do not change; you’ll only need to refresh the token itself.
Option 1: Proactive refresh. Keep track of when you first requested your token and refresh it before it expires.
Option 2: Reactive refresh. If you get a 403 (Forbidden) upon trying to upload TLE data, request a new token from /token and retry the TLE upload with the new token.