Horizons Batch CGI Script

OBSOLETE

The Horizons batch CGI script https://ssd.jpl.nasa.gov/horizons_batch.cgi is obsolete. Please instead use the Horizons API.

Key Differences

It should be reasonably simple to transition from using the obsolete CGI script to using the current Horizons API.

The URL query parameters related to Horizons keywords are unchanged. The only parameter that is specific to the CGI script is batch=1.

The CGI always outputs the raw plain-text results from Horizons. The API optionally outputs plain-text (format=text) but uses JSON by default. Note that the JSON content still contains the raw plain-text results from Horizons.

When the API is called with format=text and identical Horizons paramters, the only differences in output are at the beginning and end of the output. Specifically, the API adds the following content before the raw Horizons results.

Note that there may be more than one blank line at the end of the header section from the API as shown below.

API VERSION: 1.0
API SOURCE: NASA/JPL Horizons API

And, the CGI adds the effective Horizons input file at the end of the output while the API does not.


!$$SOF
COMMAND = 499
EPHEM_TYPE = OBSERVER
OBJ_DATA = NO
START_TIME = '2020-01-01'
STOP_TIME = '2021-01-01'
STEP_SIZE = '15d'

Examples

Below are some examples of old CGI URLs and corresponding Horizons API URLs.

CGI  https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND='499'&EPHEM_TYPE=OBSERVER&OBJ_DATA=NO&START_TIME='2020-01-01'&STOP_TIME='2021-01-01'&STEP_SIZE='15d'
API  https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='499'&EPHEM_TYPE=OBSERVER&OBJ_DATA=NO&START_TIME='2020-01-01'&STOP_TIME='2021-01-01'&STEP_SIZE='15d'
CGI  https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND='1;%3B'&EPHEM_TYPE=VECTORS&OBJ_DATA=NO&START_TIME='2020-01-01'&STOP_TIME='2021-01-01'&STEP_SIZE='15d'
API  https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='1%3B'&EPHEM_TYPE=VECTORS&OBJ_DATA=NO&START_TIME='2020-01-01'&STOP_TIME='2021-01-01'&STEP_SIZE='15d'

Help

If you are not able to convert your CGI script calls to the current Horizons API, please let us know (see Contact information in the footer below) but also provide the CGI URL you are unable to convert.