API

API Token

Skynet observers have access to the campaign manager via the API. For accessing your API token for the first time, see Skynet API Token.

Hardware Template

I did not build an API endpoint for the hardware template. See the Adding a Template page for how to create a hardware template via the web interface. This step is required before you can add an observation via the API.

Using the API

I recommend using the SkynetAPI Python package that I built for interacting with the Skynet API. For the API endpoint documentation, see the Endpoints page.

Adding an Observation

from skynetapi import ObservationRequest

payload = {
    'name': 'cm-api-test',

    # Observation parameters
    'mode': 2,
    'raHours': 15.,
    'decDegs': 25.,
    'minEl': 20,
    'maxSun': -18,
    'minMoonSepDegs': 0,
    'targetTracking': 'track_target'
           
    # Campaign Trigger parameters
    'trigger': {
        'campaign_id': 123,
        'ref_mag': 20.0,
        'ref_time': 3600.0,
        'ref_filter': 'R',

        'delay': 0.0,
        'ref_snr': 10.0,
        'exp_function': 'power',

        'event_time': '2023-04-15T05:20:00.0',
        'tem_index': -1,
        'spec_index': -0.7,
        'ebv': 0.0
    }
}

obs_request = ObservationRequest(token='your_skynet_api_token')

obs = obs_request.add(**params)

print(obs.mode, obs.name)   # output: 2, 'cm-api-test'
print(obs.trigger.env)      # output: 0.0

Last updated