Skip to main content

API

Contents

Overview

The NEOfixer API allows programs to retrieve all the information that is available on the website, excluding plots. This includes customized lists of targets and the details about specific objects. The API can also be used to report your observing status for an object to facilitate better coordination between stations.

The NEOfixer API is easy to use. The target and object pages contain API Link buttons with the API link for the data you are viewing. The target list web page also provides an API link that includes the filters you've chosen, called Filtered Targets API Link, making it very easy to build an API call for a customized list of targets. Those links can be used directly by programs.

API calls start with the following URL, which on it's own does nothing except return some built-in help:

https://neofixerapi.arizona.edu

Here is an example API call for retrieving the 10 highest priority targets for site I52, which you can click and get live results:

https://neofixerapi.arizona.edu/targets/?site=I52&num=10

If you have curl on your computer, this command line will return the same results:

curl "https://neofixerapi.arizona.edu/targets/?site=I52&num=10"

The API is similar to other APIs in the community, such as JPL's Sentry and Scout APIs. It can easily be used from curl, accessed from a web browser, and called directly from most computer languages. The API accepts HTTPS GET or POST methods and returns data in JSON or plain text. It is RESTful and JSON replies from the API adhere to JSON-RPC 2.0. However, you don't need to worry about these details if you follow this documentation.

Below is a list of the API's uses, with links to the base URL for each method. As above, the base URL alone will only provide some built-in help. However, the help below is more useful and gives more details about the parameters. Examples are provided for each method, there is Example Code, and there are Python 3 Sample Programs that get a target list and report observing status.

NEOfixer API Methods
MethodDescriptionBase URL
ephemGet site-specific ephemeris for an objecthttps://neofixerapi.arizona.edu/ephem/
obsGet observations of an objecthttps://neofixerapi.arizona.edu/obs/
orbitGet the orbit of an objecthttps://neofixerapi.arizona.edu/orbit/
reportReport your observing statushttps://neofixerapi.arizona.edu/report/
targetsGet customized target list for your sitehttps://neofixerapi.arizona.edu/targets/
uncertGet site-specific uncertainty map for an objecthttps://neofixerapi.arizona.edu/uncert/

Parameters

Each method requires at least one parameter and there are often optional parameters for refining the request, for example to filter a list of targets. Below are some common parameters used by the methods. In general parameter values are case sensitive.

Common Parameters
ParameterDescription
siteThe NEOfixer telescope or site name, which is typically the 3 character MPC code of your telescope.
objectThis is the name of an object. Currently only primary, packed designations are supported. Secondary and other types of designations will be supported eventually. Please let us know if this is important for your application.
idNot to be confused with object, this is an optional JSON-RPC transaction identifier and can be ignored unless you want to use it. The API provides immediate replies to requests, but this transaction id can also be used to link a reply to a specific request. If your request provides an id then it will be echoed back in the reply. More details are in the JSON-RPC documentation.

Ranges

Parameters with a min and max will pass values that are greater than or equal to the min and less than the max. In other words:

if value >= min and value < max then pass value
    

This way adjacent ranges can be specified without any overlapping results. Some ranges are labeled differently to avoid confusion, for example vmag-bright and vmag-faint, but work the same way numerically. There are exceptions: a declination range with a max of 90 will include 90 and similarly for a max elongation of 180.

Times

Currently times must be specified as a Julian date with a fractional date, for example 2459743.916667. This will be expanded to include more formats soon.

Booleans/Flags

Booleans or flags may be specified as '0', '1', 'false', or 'true' (without quotes).

Reply Format

Replies from the API may be in either plain text or JSON format, depending upon the request. JSON replies are formatted per JSON-RPC 2.0. All failures return JSON-RPC errors even if the successful reply would have been in plain text. For JSON replies, the basic format when the API call succeeds is:

{
      "jsonrpc": "2.0",
      "result": {info in JSON},
      "id": null
    }
    

The format when an API call fails is:

{
      "jsonrpc": "2.0",
      "error":
      {
        "code": -32602,
        "message": "Human-readable error message."
      },
      "id": null
    }
    

The jsonrpc and id keys will always be present, the latter being an echo of the optional id transaction identifier provided in the request. Upon success the result key will be present and will contain the information requested. The exact format of {info in JSON} depends on the specific method. Upon failure the error key will be present, with more information in the code and message fields. JSON-RPC defines some error codes, which this API uses.

Methods

Below are all the API methods. Required and optional parameters are listed separately.

Get Ephemeris (ephem)

Get ephemeris for an object at a site. Ephemerides are pre-calculated for each object at each site for the near future. They are recalculated whenever new astrometry is received. An ephemeris may be retrieved in its entirety or for a specific time range.

The optional time-start and time-stop parameters are used to specify the time range of the ephemeris. If they are not specified then they default to the entire available time range, which starts a few days in the past and stops a couple weeks in the future. The exact range depends on when they were last refreshed. If time-start is set to the string 'now' then the ephemeris will start with the entry at or immediately after the current time. If time-start and time-stop differ by less than the step size of the ephemeris then one entry will be returned, and will be for the time at or immediately after time-start.

API URL: https://neofixerapi.arizona.edu/ephem

Required Parameters
ParameterDescription
siteNEOfixer site name.
objectObject id.
Optional Parameters
ParameterDescriptionDefault
formatFormat of the ephemerides, either 'json' or 'text'.json
time-startStart time of the ephemeris (JD), or 'now'.earliest available
time-stopStop time of the ephemeris (JD).latest available
unobsSkip ephemeris entries where the object is unobservable by setting this to '0' or 'false'.true
updatedGet the last updated time of the pre-generated ephemeris by setting this to '1' or 'true'.false

Examples and Reply

NEOfixer uses Bill Gray's find_orb to calculate orbits and ephemerides. The ephem method returns results in the same format, though NEOfixer does specify which fields find_orb should output. Here is an example API call to retrieve a text ephemeris and the start of the resulting reply:

API call: https://neofixerapi.arizona.edu/ephem/?site=500&object=01036&format=text&time-start=now

#(500) Geocentric: (1036) Ganymed
    Date (UTC) HH:MM   RA             Dec           delta elong SM SkyBr  ExpT GC  mag  LuElo  '/hr     PA   alt  az Sal Mal " sig PA
    ---- -----------  ------------   ------------  ------ ----- -- -----  ---- --  ---  ----- ------- ------ --- --- --- --- --------
    2022 08 20 10:15  10 54 55.403   -09 19 30.97  4.9648  26.1  N 13.07  39.2 00 16.4   98.2   0.624 104.2  +18 280 -08 -56 4.2m  72
    2022 08 20 10:30  10 54 56.016   -09 19 33.26  4.9649  26.1  N 13.07  39.3 00 16.4   98.1   0.624 104.2  +18 280 -08 -56 4.2m  72
    2022 08 20 10:45  10 54 56.629   -09 19 35.56  4.9649  26.1  N 13.06  39.4 00 16.4   98.0   0.624 104.2  +18 280 -08 -56 4.2m  72
    ...
    

Here is an example API call to retrieve the same ephemeris in JSON, and part of the resulting reply:

API call: https://neofixerapi.arizona.edu/ephem/?site=500&object=01036&format=json&time-start=now

{
      "jsonrpc": "2.0",
      "result": {
        "obscode": "500",
        "packed": "01036",
        "count": 1339,
        "start": 2459811.927083333,
        "step": 0.010416667,
        "n_steps": 1338,
        "start iso": "2022-08-20T10:15:00Z",
        "entries": [
          {
            "JD": 2459811.927083333,
            "ISO_time": "2022-08-20T10:15:00Z",
            "RA": 163.7308465748,
            "RA60": "10 54 55.403",
            "Dec": -9.32526923639,
            "Dec60": "-09 19 30.97",
            "delta": 4.964842311323,
            "elong": 26.10288,
            "SM": "N",
            "SkyBr": 13.07,
            "RGB": "5e939b",
            "ExpT": 39.2,
            "OptExpT": 17.7,
            "GC": 0.388,
            "mag": 16.337,
            "LuElo": 98.18163,
            "motion_rate": 0.624301,
            "motionPA": 104.1895,
            "alt": 17.6595,
            "az": 279.6606,
            "Sal": -8.4434,
            "Mal": -56.3862,
            "sigPos": 0.004,
            "sigPA": 72
          },
    ...
        ]
      },
      "id": null
    }
    

Get Observations (obs)

Get observations of an object in 80-column plain text format.

API URL: https://neofixerapi.arizona.edu/obs

Required Parameters
ParameterDescription
objectObject id.

Here is an example API call and the result:

API call: https://neofixerapi.arizona.edu/obs/?object=K22L00P

     K22L00P* C2022 06 04.34120816 03 49.363+33 58 59.59         20.00GVEL035G96
         K22L00P  C2022 06 04.34643216 03 51.563+33 58 07.36               VEL035G96
         K22L00P  C2022 06 04.35166116 03 53.802+33 57 14.08         20.34GVEL035G96
         K22L00P  C2022 06 04.35687916 03 56.045+33 56 21.12               VEL035G96
         K22L00P mC2022 06 04.44594016 04 36.077+33 40 51.56         20.18GVEL035I52
         K22L00P mC2022 06 04.44625516 04 36.206+33 40 48.22         20.64GVEL035I52
         K22L00P mC2022 06 04.44657116 04 36.361+33 40 44.87         20.19GVEL035I52
         K22L00P mC2022 06 04.44688816 04 36.476+33 40 41.02         20.98GVEL035I52
    ...
    

Get Orbit (orbit)

Get orbit of object(s) in JSON format.

API URL: https://neofixerapi.arizona.edu/orbit

Required Parameters (mutually exclusive, only one may be used)
ParameterDescription
objectOne object id.
object[]Used to specify multiple objects. Use "object[]=ID" for each object.
siteReturn the orbits of all the objects in the target list of this site. If site 500 is specified then the orbits of all NEOs will be returned.

Examples and Reply

Only one of the required parameter types may be used, but the returned JSON format is the same for all requests. The orbital elements format is that of Bill Gray's find_orb. The objects are returned using their packed designation as an index even if they were requested using their unpacked designation, though the unpacked designation is included in the results (see examples).

Example API call to get the orbit of one object, and the result:

API call: https://neofixerapi.arizona.edu/orbit/?object=K22L00P

{
  "jsonrpc": "2.0",
  "result": {
    "generated": {
      "jd": 2460384.52853,
      "time": "2024-03-15T00:41:04Z"
    },
    "num": 1,
    "ids": [
      "K22L00P"
    ],
    "objects": {
      "K22L00P":
      {
        "object": "2022 LP",
        "packed": "K22L00P",
        "created": 2460383.78124,
        "created iso": "2024-03-14T06:44:59Z",
        "Find_Orb_version": 2460368.50000,
        "Find_Orb_version_iso": "2024-02-28T00:00:00Z",
        "elements":
        {
          "central body": "Sun",
          "frame": "J2000 ecliptic",
          "reference": "NEOfixer",
          "epoch_iso": "2022-06-05T00:00:00Z",
          "epoch":  2459735.50000000,
          "P": 1201.8267612552393, "P sigma": 1.4,
          "M": 356.2323346790081, "M sigma": 0.0046,
          "n":   0.2995440038496, "n sigma": 0.000348,
          "a":   2.2122233005275, "a sigma": 0.00171,
          "e":   0.5365637272715, "e sigma": 0.000356,
          "q":   1.0252245208396, "q sigma": 5.21e-6,
          "Q":   3.3992220802153, "Q sigma": 0.00342,
          "i":  17.4023923975491, "i sigma": 0.006,
          "arg_per":  189.0563747983292, "arg_per sigma":  0.00019,
          "asc_node":  78.8933793073332, "asc_node sigma": 0.00008,
          "Tp": 2459748.07800281, "Tp sigma": 0.000923,
          "Tp_iso": "2022-06-17T13:52:19.442Z",
          "H":  25.27,
          ...
    

Example API call to get the orbit of 3 objects:

API call: https://neofixerapi.arizona.edu/orbit/?object[]=1979%20XB&object[]=A1955&object[]=K22L00P

{
  "jsonrpc": "2.0",
  "result": {
    "generated": {
      "jd": 2460384.558877,
      "time": "2024-03-15T01:24:47Z"
    },
    "num": 3,
    "ids": [
      "J79X00B",
      "A1955",
      "K22L00P"
    ],
    "objects": {
      "J79X00B":
      {
        "object": "1979 XB",
        "packed": "J79X00B",
        "created": 2460381.94356,
        "created iso": "2024-03-12T10:38:43Z",
        "Find_Orb_version": 2460368.50000,
        "Find_Orb_version_iso": "2024-02-28T00:00:00Z",
        "elements":
        {
          "central body": "Sun",
          ...
    

Example API call to get the orbits of all objects in the target list of a site:

API call: https://neofixerapi.arizona.edu/orbit/?site=I52

{
  "jsonrpc": "2.0",
  "result": {
    "generated": {
      "jd": 2460384.565637,
      "time": "2024-03-15T01:34:31Z"
    },
    "num": 1518,
    "ids": [
      "A114Syx",
      "xkos383",
      "or02469",
      "C0R5Q45",
      "CACK8D2",
      "K16GM0S",
      ...
    

Report Observing Status (report)

This method allows you to report your observing status of an object at a site, for example to report that you will observe a particular object or that you have reported new astrometry for an object. This allows better coordination between sites. Currently status reports are used to calculate a community observing interest in an object and to adjust the scores of objects to reduce the likelihood of duplicated effort. NEOfixer will soon provide more information to users about the observing efforts of others, accept more information about observing, and improve how the status reports are used.

Note that an account is required to report your observing status.

API URL: https://neofixerapi.arizona.edu/report

Required Parameters
ParameterDescription
keyAPI key from your NEOfixer profile. See your Profile's View Tab and look for the API key.
siteNEOfixer site name. Needed since the API key identifies the user but users may have access to multiple sites.
objectObject id.
status

Status of object at site. Case insensitive. One of:

  • may_observe
  • will_observe
  • observing
  • observed
  • found
  • reported
  • not_found
  • canceled
Optional Parameters
ParameterDescriptionDefault
timeTime of the status change (JD) or 'now'.now
testTest mode if set to '1' or 'true'. All checks will be performed and a reply returned but the report will not be recorded.false

Examples and Reply

For example, this is how I52 would tell NEOfixer that it just observed Apophis (99942), where the actual API key has been redacted:

API call: https://neofixerapi.arizona.edu/report/?key=<api-key>&site=I52&object=99942&status=observed

If all is well the reply will be:

{
      "jsonrpc": "2.0",
      "result": true,
      "id": null
    }
    

See Reply Format for the format of error replies.

Get Targets (target)

Get NEOfixer target list for a site, highest scoring targets first.

Some of the values reported and used for filtering change with time, for example the NEOfixer score, cost, and ephemeris values. By default, the values are evaluated at the time of the max NEOfixer score during the current or coming night, local to the site. Alternatively, the when parameter can be set to now to filter on and retrieve current values. Be aware that if you use when=now then objects that aren't currently observable, for example due to limits or because it is daylight, will have NEOfixer scores and costs of null. In the default when=max case targets are compared for the entire night, while in the when=now case targets are compared for right now. Telescopes that perform a lot of follow-up during a night may be best served by using the default of max, while telescopes with occasional free time to do follow-up may be more interested in the best targets they can do now. Remember that the ephem API method is available for retrieving a more detailed ephemeris for a specific object, including for a range of times or a specific time.

API URL: https://neofixerapi.arizona.edu/targets

Required Parameters
ParameterDescription
siteNEOfixer site name.
Optional Parameters
ParameterDescriptionDefault
numNumber of targets to return.all matching targets
allReturn all targets for site, disregarding all other parameters.false
whenTime at which variable values are evaluated. Use 'max' for the time of the max NEOfixer score or 'now' for the current values. See above for more details.max
Scores
score-minMin NEOfixer score.0
score-maxMax NEOfixer score.999999
cost-minMin cost to observe (minutes).0
cost-maxMax cost to observe (minutes).999999
Ephemeris values
vmag-brightBrightest (V magnitude).-99
vmag-faintFaintest (V magnitude).99
uncert-minMin uncertainty (degrees).0
uncert-maxMax uncertainty (degrees).360
rate-minMin rate (arcsecs/min).0
rate-maxMax rate (arcsecs/min).9999999
elong-minMin elongation (degrees).0
elong-maxMax elongation (degrees). Specifying 180 will include 180.180
ra-startInclude targets with RA >= this, or < this if ra-stop < ra-start (degrees).0
ra-stopInclude targets with RA < this, or >= this if ra-stop < ra-start (degrees).360
dec-minMin declination (degrees).-90
dec-maxMax declination (degrees). Specifying 90 will include 90.90
gc-minMin galactic confusion (percent).0
gc-maxMax galactic confusion (percent). Specifying 100 will include 100.100
Orbit-related
h-minMin H.0
h-maxMax H.99
moid-minMin MOID.0
moid-maxMax MOID.99
Arc length categories (see details after table)
neocpInclude NEOCP objects.true
1opp-nowInclude unnumbered objects with a single opposition occurring now.true
1opp-pastInclude unnumbered objects with a single opposition in the past.true
multi-oppInclude unnumbered objects with multiple oppositions.true
numberedInclude numbered objects.true
Other categories
impactorsInclude potential impactors.true
radarInclude radar targets.true
yarkovskyInclude Yarkovsky candidates.true
nhatsInclude potential NHATS targets.true
otherInclude objects not in the previous 4 categories.true

Every object is in only one arc length category. The corresponding parameters neocp, 1opp-now, 1opp-past, mult-opp, and numbered behave like this:

  1. If none of these parameters are specified then all objects pass these filters.
  2. If one or more of them are set to 1 or true then only objects in those categories will be included.
  3. If one of more of them are set to 0 or false then objects in those categories will be excluded.

There are examples below.

Examples

As you can see, there are many filters for requesting targets. Remember that the target list page has a Filtered Targets API Link that contains all the filters you've set (after you click Apply). It is very useful for building a custom query. While you only need to specify parameters that you want to change from the defaults, here is an API URL containing all the parameters set to their defaults, except for num and all. It may be a useful starting point to trim down to what you want. I recommend leaving out parameters that are set to their defaults as it is possible that the default could change in the future:

https://neofixerapi.arizona.edu/targets/?site=I52&score-min=0&score-max=999999&cost-min=0&cost-max=999999&vmag-bright=-99&vmag-faint=99&uncert-min=0&uncert-max=360&rate-min=0&rate-max=9999999&elong-min=0&elong-max=180&h-min=0&h-max=99&moid-min=0&moid-max=99&ra-start=0&ra-stop=360&dec-min=-90&dec-max=90&gc-min=0&gc-max=100&neocp=1&1opp-now=1&1opp-past=1&multi-opp=1&numbered=1&impactors=1&radar=1&yarkovsky=1&nhats=1&other=1

As mentioned above, the arc length categories behave a little differently, but conveniently, and the examples below should help illustrate how they work. For example, to get only NEOCP objects use:

&neocp=1

To exclude just numbered objects use:

&numbered=0

Either of the following would return neocp plus single opposition objects only:

&neocp=1&1opp-now=1&1opp-past=1

or

&multi-opp=0&numbered=0

The Example Code section has some more examples of using the targets method.

Reply

The returned objects are sorted from highest scoring to lowest scoring. The JSON reply starts out like this example, where two targets were requested:

{
      "jsonrpc": "2.0",
      "result": {
        "generated": {
          "jd": 2459776.488356,
          "time": "2022-07-15T23:43:13Z"
        },
        "num": 2,
        "ids": [
          "C34UMY1",
          "C7YDPT2"
        ],
        "objects": {
          "C34UMY1": {
            "packed": "C34UMY1",
            "provisional": null,
            "number": null,
            "priority": "critical",
            "score": 9.57,
            "cost": 1.8,
            "importance": 12,
            "urgency": 100,
            "interest": null,
            "status": null,
            "jd": 2459746.833333,
            "time": "2022-06-16T08:00:00Z",
            "ra": "23:06:54",
            "ra deg": 346.72512,
            "dec": "+16:15:42",
            "dec deg": 16.26166,
            "vmag": 18.4,
            "uncert": 0.079703,
            "rate": 44.1,
            "elong": 90.4,
            "gc": 0,
            "obs num": 3,
            "obs used": 3,
            "obs last": 0.01,
            "arc len": 0.01,
            "arc used": 0.01,
            "residual": 0.6,
            "u": 12.53,
            "h": 26.8,
            "q": 0.959,
            "moid": 0.0011,
            "neocp": true,
            "neo": 98,
            "geo": 0,
            "impact": null,
            "nhats": null,
            "radar": null,
            "yarkov": null
          },
          "C7YDPT2": {
            "packed": "C7YDPT2",
    ...
            "yarkov": null
          }
        }
      },
      "id": null
    }
    

The values returned for each object are detailed in the following table.

Returned in "result"
KeyDescription
generatedThe time the reply was generated, in Julian date ("jd") and ISO 8601 ("time") formats.
numNumber of objects returned.
idsList of the packed designations of the objects returned.
objectsArray of all the objects, indexed by their packed designations, and containing details about each object (see next table).
Returned details for each object in "objects"
KeyDescriptionUnits
packedPacked designation. 
provisionalProvisional designation. 
numberNumbered designation. 
priorityNEOfixer priority string. 
scoreNEOfixer score. 
costEstimated cost to observe the object by taking 3 images.minutes
importanceImportance score. 
urgencyUrgency score. 
interestNumeric representation of the community's recent reported interest in observing or having observed the object. 
statusYour reported observing status. 
jdTime of the max NEOfixer score for the night, or the time of min cost if the score is constant. This is also the time of the ephemeris values reported.Julian days
timeSame time as 'jd' but in ISO 8601 format. 
raRA in sexagesimal format.hours
ra degRA in decimal degrees.degrees
decDeclination in sexagesimal format.degrees
dec degDeclination in decimal degrees.degrees
vmagMagnitude.V band
uncert1-sigma uncertainty.degrees
rateRate of motion.arcsec/min
elongElongation from the Sun.degrees
gcGalactic confusion from 0-100. 
obs numTotal number of observations. 
obs usedNumber of observations used in orbit solution. 
obs lastTime since last observation.days
arc lenArc length of observations.days
arc usedArc length of observations used in orbit solution.days
residualRMS residual of astrometry used versus calculated positions.arcsec
u"U parameter" or orbit uncertainty. 
hAbsolute magnitude, H. 
qPerihelion distance.AU
moidEarth MOID.AU
neocp"true" if object is on the MPC's NEOCP, else "false". 
neoProbability of being a NEO.%
geoProbability of being geocentric.%
impactFor NEOCP objects this is the JPL Scout impact rating, if present. For catalog objects this is the JPL Sentry impact probability, if present. Otherwise it is "null". 
nhatsNHATS number of viable trajectories, else "null". 
radarDate of planned radar observations, else "null". 
yarkovYarkovsky effect "SNR_exp", else "null". 

Get Uncertainty Offsets (uncert)

Get uncertainty offsets for an object at a site, in a text format similar to the MPC's. For some objects find_orb employs statistical ranging and generates uncertainty offsets from the variant orbits, in which case NEOfixer returns those offsets. For the rest of the objects, find_orb returns the 1s uncertainty and the PA of the line of variation (see Get Ephemeris if you want those values). For the uncert API call NEOfixer converts those into a set of normally distributed offsets. It returns 65 points because that results in the furthest points being at roughly ±2.5s and the next furthest at ±2.0s while maintaining the proper distribution density and giving a good number of points for larger uncertainty plots (actually ±2.516s and ±2.001s).

The returned text contains pairs of RA Dec offsets in arcseconds relative to the nominal position.

API URL: https://neofixerapi.arizona.edu/uncert

Required Parameters
ParameterDescription
siteNEOfixer site name.
objectObject id.
Optional Parameters
ParameterDescriptionDefault
timeTime of the uncertainty offsets, 'now' or JD with fractional day.now
updatedGet only the last updated time of generated offsets by setting this to '1' or 'true'.false

Here is an example API call and the result:

API call: https://neofixerapi.arizona.edu/uncert/?site=I52&object=A10HVHg

# JD 2459743.916667 = 2022 Jun 13 10:00
    #      A10HVHg
    # 200 points; 87673.3 x 3864.2 ellipse at 1.3
    0.0 0.0
    -115.0 -192.2
    41.8 48.0
    -22.1 1.9
    -88.7 -204.7
    -93.6 -135.9
    ...
    

Example Code

Any language that can retrieve web pages and parse JSON can be used to talk to the NEOfixer API. You could also use scripting languages that can execute other programs.

curl and jq

While not really code, curl can often be executed from other programs or scripts. As mentioend in the overview, a simple way to use the API is via curl:

curl -s "https://neofixerapi.arizona.edu/targets/?site=I52&num=4"

This can be combined with jq to extract specific information. For example, to get the cost of the first four targets for a site:

curl -s "https://neofixerapi.arizona.edu/targets/?site=I52&num=4" | jq .result.objects[].cost

Output:

1.8
    1.6
    8.9
    2.1
    

Python 3

Here are two different ways to use the API from Python 3. Which one you use may depend on what your system supports and what other features you need. The sample programs for download use the first method and enable built-in retries to improve reliability in the event of a bad network connection.

Using requests library

This first example uses HTTP GET with a URL containing the parameters to get the first two targets for a site:

import requests
    # Get API result.
    r = requests.get ('https://neofixerapi.arizona.edu/targets/?site=I52&num=2')
    # Convert JSON to a dictionary.  Note that some API calls return plain text, in which case you would use r.text instead.
    d = r.json ()
    print (d)
    print (d['result']['ids'])
    

This will do the same thing, but uses HTTP POST and provides a different way to pass parameters:

import requests
    # Get API result.
    params = {'site': 'I52', 'num': 2}
    r = requests.post ('https://neofixerapi.arizona.edu/targets/', data = params)
    # Convert JSON to a dictionary.  Note that some API calls return plain text, in which case you would use r.text instead.
    d = r.json ()
    print (d)
    print (d['result']['ids'])
    

Output from either one:

{'jsonrpc': '2.0', 'result': {'num': 2, 'ids': ['C34UMY1', 'C7YDPT2'], 'objects': {'C34UMY1': {'packed': 'C34UMY1', 'provisional': None, 'number': None, 'priority': 'critical', 'score': 9.57, 'cost': 1.8, 'importance': 12, 'urgency': 100, 'interest': 0.7, 'status': 'observing', 'jd': 2459746.833333, 'time': '2022-06-16T08:00:00Z', 'ra': '23:06:54', 'ra deg': 346.72512, 'dec': '+16:15:42', 'dec deg': 16.26166, 'vmag': 18.4, 'uncert': 0.079703, 'rate': 44.1, 'elong': 90.4, 'gc': 0, 'obs num': 3, 'obs used': 3, 'obs last': 0.01, 'arc len': 0.01, 'arc used': 0.01, 'residual': 0.6, 'u': 12.53, 'h': 26.8, 'q': 0.959, 'moid': 0.0011, 'neocp': True, 'neo': 98, 'geo': 0, 'impact': None, 'nhats': None, 'radar': None, 'yarkov': None}, 'C7YDPT2': {'packed': 'C7YDPT2', 'provisional': None, 'number': None, 'priority': 'high', 'score': 7.31, 'cost': 1.6, 'importance': 19, 'urgency': 1.95, 'interest': 1, 'status': 'reported', 'jd': 2459746.65625, 'time': '2022-06-16T03:45:00Z', 'ra': '13:22:22', 'ra deg': 200.59312, 'dec': '+01:13:20', 'dec deg': 1.22229, 'vmag': 19.5, 'uncert': 0.003832, 'rate': 12.5, 'elong': 113.5, 'gc': 0, 'obs num': 8, 'obs used': 8, 'obs last': 0.14, 'arc len': 0.06, 'arc used': 0.06, 'residual': 0.3, 'u': 12.15, 'h': 24.6, 'q': 1.021, 'moid': 0.0133, 'neocp': True, 'neo': 100, 'geo': 0, 'impact': 0, 'nhats': None, 'radar': None, 'yarkov': None}}}, 'id': None}
['C34UMY1', 'C7YDPT2']

Using urllib and json libraries

This also does the same thing as the above examples, but uses different python libraries.

import urllib.request
    import json
    # Get API result.
    with urllib.request.urlopen ('https://neofixerapi.arizona.edu/targets/?site=I52&num=2') as response:
      text = response.read ().decode ("utf_8")
    # Convert JSON to a dictionary.  Note that some API calls return plain text, in which case you can skip this step.
    d = json.loads (text)
    print (d['result']['ids'])
    

Output:

['C34UMY1', 'C7YDPT2']
    

Tcl

Here is Tcl code that gets the first two targets for a site:

package require json
    package require http
    package require tls
    http::register https 443 [list tls::socket]
    set token [http::geturl "https://neofixerapi.arizona.edu/targets/?site=I52&num=2"]
    set text [http::data $token]
    set d [json::json2dict $text]
    puts $d
    puts [dict get $d result ids]
    

Output:

jsonrpc 2.0 result {num 2 ids {C34UMY1 C7YDPT2} objects {C34UMY1 {packed C34UMY1 provisional null number null priority critical score 9.57 cost 1.8 importance 12 urgency 100 interest 0.7 status observing jd 2459746.833333 time 2022-06-16T08:00:00Z ra 23:06:54 {ra deg} 346.72512 dec +16:15:42 {dec deg} 16.26166 vmag 18.4 uncert 0.079703 rate 44.1 elong 90.4 gc 0 {obs num} 3 {obs used} 3 {obs last} 0.02 {arc len} 0.01 {arc used} 0.01 residual 0.6 u 12.53 h 26.8 q 0.959 moid 0.0011 neocp true neo 98 geo 0 impact null nhats null radar null yarkov null} C7YDPT2 {packed C7YDPT2 provisional null number null priority high score 7.31 cost 1.6 importance 19 urgency 1.95 interest 1 status reported jd 2459746.65625 time 2022-06-16T03:45:00Z ra 13:22:22 {ra deg} 200.59312 dec +01:13:20 {dec deg} 1.22229 vmag 19.5 uncert 0.003832 rate 12.5 elong 113.5 gc 0 {obs num} 8 {obs used} 8 {obs last} 0.15 {arc len} 0.06 {arc used} 0.06 residual 0.3 u 12.15 h 24.6 q 1.021 moid 0.0133 neocp true neo 100 geo 0 impact 0 nhats null radar null yarkov null}}} id null
C34UMY1 C7YDPT2

Sample Programs

DescriptionLanguageViewDownload
Get a customized list of targets, applying a variety of optional filtersPython 3nftargets.py

 

Report the status of observing objectsPython 3nfreport.py

 

These can be run using, for example, python3 nftargets.py. On Linux if the first line in the program contains the path to python3 then you can just type nftargets.py, and you might want to rename it to just nftargets.

nftargets.py

Here is the help for nftargets.py:

usage: nftargets.py [-s SITE] [-n NUM] [-o ID [ID ...]] [-A] [-U URL]
                        [-c COST COST] [-S SCORE SCORE] [-m MAG MAG]
                        [-r RATE RATE] [-u UNCERT UNCERT] [-g GC GC] [-R RA RA]
                        [-D DEC DEC] [-h]
    Get targets from NEOfixer. All arguments are optional. In the descriptions
    below the units are enclosed in () and the defaults are enclosed in [].
    Switches with two arguments are ranges from the first value (min) to the
    second value (max) and pass values >= min and < max. See the NEOfixer API
    documentation for more details. Version: 1.0 2022-06-14
    Target selection:
      -s SITE           Site code [I52]
      -n NUM            Number of objects [40]
      -o ID [ID ...]    Get specific object(s), ignoring filters [None]
      -A                All targets, ignoring all filters [False]
      -U URL            Use URL to get targets instead of command line filters.
                        This could be an "API Link" from the website. [None]
    Target characteristics:
      -c COST COST      Cost (minutes) [0 300]
      -S SCORE SCORE    NEOfixer score [0 20]
      -m MAG MAG        Magnitudes: brightest then faintest (V) [0 99]
      -r RATE RATE      Rates ("/min) [0 100000]
      -u UNCERT UNCERT  Uncertainty, 1-sigma (degrees) [0 15]
      -g GC GC          Galactic confusion (0-100) [0 25]
      -R RA RA          R.A. (decimal deg) [0 360]
      -D DEC DEC        Dec (decimal deg) [-90 90]
    Other:
      -h, --help        Display this help message and exit [False]
    

nfreport.py

Here is the help for nfreport.py:

usage: nfreport.py [-r STATUS] [-s SITE] [-k KEY] [-t TIME] [-h] [-T]
                       OBJECT [OBJECT ...]
    Report your observation status of objects to NEOfixer. Below units are
    enclosed in () and defaults are enclosed in []. Version: 1.0 2022-06-14
    Required:
      OBJECT      Object name or list of object names.
      -r STATUS   Status to report for the object(s). Case insensitive. One of
                  'may_observe', 'will_observe', 'observing', 'observed', 'found',
                  'reported', 'not_found', or 'canceled'.
    Optional:
      -s SITE     NEOfixer site name. [I52]
      -k KEY      API key from NEOfixer account profile. [set in program]
      -t TIME     Time of the action (JD) or 'now'. [now]
    Other:
      -h, --help  Display this help and exit. [False]
      -T          Test. The request will be validated by the servers and a reply
                  will be returned but no action will be taken. [False]