Root API call's Q:?

Can I call the api to return a png?

I don’t see any documentation on the api.

I would like to get more precise with the return. specifically the most recent “payload_demod”: “https://network-satnogs.freetls.fastly.net/media/data_obs/3294428/data_3294428_2020-12-14T17-46-26.png” from my NOAA apt pass’s.

https://network.satnogs.org/api/observations/?id=&status=good&ground_station=984&start=&end=&satellite__norad_cat_id=&transmitter_uuid=&transmitter_mode=APT&transmitter_type=&waterfall_status=1&vetted_status=good&vetted_user=&payload_demod=1

Is it better to just write a post pass script to uploads it to my server?

There isn’t an API to return directly the image. You need to use the observations API endpoint and check the field demoddata to get the link to the image.

is there a document on the observations API endpoint?

Documentation is a work in progress. However browsing the https://network.satnogs.org/api/observations/ endpoint and using filters can give you some hints on how it works. If something is not very clear, let me know to help you.

I see the field demoddata Just wish I could use the api to return that field, so I can Wget files. Do you have any examples of code that uses the api’s return to find and download the file in the “payload_demod” field?

Q; think that :
“Start is greater than or equal to”
“End is less than or equal to”

Implies a date? in what format?

Here is some python example code that checks all the observations of one satellite from now back to a given date and prints all the payload_demod that it finds on these observations (maybe there are better ways to implement this but you can get an idea):

import json
import sys
import requests
import re
from time import sleep, gmtime, strftime
from datetime import datetime

try:
    norad_id = int(sys.argv[1])
except:
    print('Please give a valid norad id')
    sys.exit()

try:
    date = str(sys.argv[2])
except:
    print('Please give a valid date for example 2018-07-29T07:10:00Z')
    sys.exit()

status = ''
try:
    status = str(sys.argv[3])
except:
    pass

now = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
url = 'https://network.satnogs.org/api/observations/?format=json&satellite__norad_cat_id=' + str(norad_id) + '&end=' + now

if status:
    url += '&status=' + status

next_url = url
while next_url is not '':
    print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
    print("Requesting " + next_url)
    sleep(2)
    r = requests.get(next_url)

    if 'Link' in r.headers:
        if 'next' in r.headers['Link']:
            regex = r"<(.*)>.*next.*"
            next_url = matches = re.match(regex, r.headers['Link']).groups()[0]
            sleep(2)
        else:
            next_url = ''
    else:
        next_url = ''

    observations = json.loads(r.content.decode('utf8'))
    for observation in observations:
        obs_id = str(observation['id'])
        obs_start = observation['start']
        if obs_start > date:
            if observation['demoddata']:
              for datum in observation['demoddata']:
                  print(datum['payload_demod'], flush=True)
        if obs_start < date:
            print("Stop looking for next observations, last was obs: " + obs_id + "\n")
            exit(1)

Example how to run it (it may need to install some python packages):

python get_payload_demod.py 28654 2020-12-24T00:00:00Z good

In the example you can see how the date is formatted.

1 Like