Trying to retrieve Telemetry data through the API and getting error 401

I can retrieve the satellite and the TLE data with the same code but not the TLE data. I send the username and the API token through the request.get() in python along with the url. I am still unable to get the data though

Hello and welcome to Libre Space community.

I did not understand exactly what does not work for you. Can you provide the api endpoint you are using and what do you expect to get?

I am using Rest API in Python
Here is the code snippet.

def telemetry_data():
    """
    This method uses REST API to get telemetry data from the Satnogs website
    """
    url = 'https://db.satnogs.org/api/telemetry/'
    username = "XXXXXXXXXXX"
    token = "Token XXXXXXXX"
    # Make a GET request to the API
    response = requests.get(url,headers={'Authorization': 'Token XXXXXXXXXX'})

    # Check if the request was successful
    if response.status_code == 200:
        print("Request successful")
        # Convert JSON response to DataFrame
        df = pd.DataFrame(response.json())
        return df
    else:
        print("Failed to retrieve data. Status code:", response.status_code)
        return pd.DataFrame()  # Return an empty DataFrame in case of failure

Your request to pass the Authorization token is correct but you also need to provide a NORAD ID for the response to return the telemetry else the response is HTTP 400 Bad Request.

You can try for example

requests.get(url,headers={'Authorization': 'Token 123abc'}, params={'satellite':'*norad_id_you_want*'})

Also i hope you have not posted your real api key.

Hope that helps

1 Like

Hi @spaceexp263,

I’ve removed your API token as you published it in your previous post. You can get a new one in the Network site.

About your issue, the API token you use is for Network but you ask data from DB. You need to get the DB API Token. After your login in DB site you can get it by clicking your avatar at the top right and select “Settings/API Token”.

2 Likes

Thank you for helping me out. I can retrieve the Telemetry data. How many requests to retrieve the data can you make in 24 hours?

For satellite that don’t violate frequency regulations is 6 requests per minute, for violators the limit is 1 request per day.

Have in mind that you can export frames from the satellite page if needed.

1 Like

Thank you for your answer. Which API get request should I make if I want access to the following data : https://network.satnogs.org/observations/ ?

All the info for observations can be found in this endpoint: https://network.satnogs.org/api/observations/

1 Like