MPC WAMO API (Where Are My Observations)¶
This tutorial explains how to use the Minor Planet Center's WAMO API to check submitted observations.¶
The WAMO API helps investigate individual observations and is useful for checking the status of submitted data.
The WAMO API is a REST endpoint. You can use your language of choice to send GET requests to:
https://data.minorplanetcenter.net/api/wamo
In the examples below we use Python code to query the API.
Further information about the WAMO API can be found at:
Import Packages¶
Here we import the standard Python packages needed to call the API and inspect the returned data.
import requests
import json
# Trivial function to truncate a print statement for the purposes of display
def truncated_print(s:str,l:int=2000):
print(s[:l])
if len(s) > l:
print('\n(truncated for display)')
Identifier Formats¶
You can query the API with ~50k identifiers. Each identifier may return up to 100k observations.
Astrometry will be suppressed for unpublished observations.
The following identifier formats are accepted (and can be mixed):
- Tracklet Submission ID + Station Code (ADES or no unique observation ID)
- Format:
trkSub stn(two values separated by a space) - Example:
5T0D452 703
- Format:
- Observation ID (from acknowledgement messages)
- Example:
L4eBVG000000CfiO010000A9a
- Example:
- MPC 1992 80- or 160-column observation string
- Paste exactly as submitted
- Submission block ID
- Example:
2024-05-02T21:03:35.001_0000FzZw_01
- Example:
Query Payload Formats¶
You can query the API in two ways:
List of identifiers: returns JSON
['5T0D452 703', 'L4eBVG000000CfiO010000A9a']Include the magic
"string"element: returns the same text as the original WAMO tool['string', '5T0D452 703', 'L4eBVG000000CfiO010000A9a']
The "string" item can be placed anywhere in the list.
Basic Query (JSON Response)¶
Here we query using a tracklet submission ID and station code.
url = "https://data.minorplanetcenter.net/api/wamo"
obs_list = ["5T0D452 703"]
response = requests.get(url, json=obs_list)
response.raise_for_status()
wamo_response = response.json()
truncated_print(json.dumps(wamo_response, indent=2))
{
"found": [
{
"5T0D452 703": [
{
"iau_desig": "29149",
"input_type": "trkSub",
"obs80": "29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703",
"obsid": "JueAhg010000566w0100000Te",
"obssubid": null,
"ref": "MPS 145016",
"status": "P",
"status_decoded": "29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703 (JueAhg010000566w0100000Te) has been identified as (29149) and published in MPS 145016.",
"submission_block_id": "2005-10-10T11:25:48.001_0000566w_01",
"submission_id": "2005-10-10T11:25:48.001_0000566w"
},
{
"iau_desig": "29149",
"input_type": "trkSub",
"obs80": "29149 C2005 10 10.39767 02 57 11.91 +09 01 42.1 16.4 Vro5016703",
"obsid": "JueAhg010000566w0100000Tf",
"obssubid": null,
"ref": "MPS 145016",
"status": "P",
"status_decoded": "29149 C2005 10 10.39767 02 57 11.91 +09 01 42.1 16.4 Vro5016703 (JueAhg010000566w0100000Tf) has been identified as (29149) and published in MPS 145016.",
"submission_block_id": "2005-10-10T11:25:48.001_0000566w_01",
"submission_id": "2005-10-10T11:25:48.001_0000566w"
},
{
"iau_desig": "29149",
"input_type": "trkSub",
"obs80": "29149 C2005 10 10.40533 02 57 11.66 +09 01 37.1 16.5 Vro5016703",
"obsid": "JueAhg010000566w0100000Tg",
"obssubid": null,
"ref": "MPS 145016",
"status": "P",
"status_decoded": "29149 C2005 10 10.40533 02 57 11.66 +09 01 37.1 16.5 Vro5016703 (JueAhg010000566w0100000Tg) has been identified as (29149) and published in MPS 145016.",
"submission_block_id": "2005-10-10T11:25:48.001_0000566w_01",
"submission_id": "2005-10-10T11:25:48.0
(truncated for display)
Mixed Identifier Query¶
You can combine multiple identifier types in a single request.
The returned data structure is a list of dictionaries, one dictionary per found input-identifier.
obs_list = [
"5T0D452 703",
"L4eBVG000000CfiO010000A9a",
"29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703",
"2024-05-02T21:03:35.001_0000FzZw_01"
]
response = requests.get(url, json=obs_list)
response.raise_for_status()
wamo_response = response.json()
# Print the number of returned items & the result keys ( == input search strings)
print(f"Found records: {len(wamo_response['found'])}")
print(f"\nRecord Keys:")
for i, item in enumerate(wamo_response['found']):
print(f'\t{i}:{list(item.keys())}')
# Print the return data for result [2]
print(f"\nExample returned record for item [2]:")
for key,value in wamo_response['found'][2].items():
print(f'{key=}')
truncated_print(f'value={json.dumps(v, indent=2)}')
Found records: 4
Record Keys:
0:['5T0D452 703']
1:['L4eBVG000000CfiO010000A9a']
2:['29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703']
3:['2024-05-02T21:03:35.001_0000FzZw_01']
Example returned record for item [2]:
key='29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703'
value=[
{
"iau_desig": "29149",
"input_type": "obs80",
"obs80": "29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703",
"obsid": "JueAhg010000566w0100000Te",
"obssubid": null,
"ref": "MPS 145016",
"status": "P",
"status_decoded": "29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703 (JueAhg010000566w0100000Te) has been identified as (29149) and published in MPS 145016.",
"submission_block_id": "2005-10-10T11:25:48.001_0000566w_01",
"submission_id": "2005-10-10T11:25:48.001_0000566w"
}
]
Searching for non-existent data¶
If some of the input query items are NOT present in the MPC database, then the number of returned items will be shorter than the input list.
If some of the input query items cannot be parsed as an obsid, trksub, submission_id, or submission_block_id, a malformed quantity will be returned.
obs_list = [
"5T0D452 703", # This "trkSub stn" record exists in the MPC database
"L4eBVG000111CfiO010111A9a", # This obsID does NOT exist in the MPC database
"2023-04-02T22:02:32.001_0000FyZw_02",# This submission_block_id does NOT exist in the MPC database
"bi#_%_&ldvfanoj48034803480" # This string of nonsense does NOT exist in the MPC database
]
response = requests.get(url, json=obs_list)
response.raise_for_status()
wamo_response = response.json()
# Print the number of returned items & the result keys ( == input search strings)
print(f"Found records: {len(wamo_response['found'])}")
print(f"\nRecord Keys:")
for i, item in enumerate(wamo_response['found']):
print(f'\t{i}:{list(item.keys())}')
# Print information on any malformed input
if wamo_response["malformed"]:
print(f"\nInformation on Malformed Input:")
for item in wamo_response["malformed"]:
for _ in item:
print(f'\t{_}')
Found records: 1 Record Keys: 0:['5T0D452 703'] Information on Malformed Input: bi#_%_&ldvfanoj48034803480 Note that one or more of your lines including "bi#_%_&ldvfanoj48034803480" could not be parsed as an obsid, trksub, submission_id, or submission_block_id.
Original WAMO String Output¶
Include the "string" element in the list to receive the original WAMO string-formatted output.
response = requests.get(url, json=["string", "5T0D452 703"])
response.raise_for_status()
truncated_print(response.text)
29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703 (JueAhg010000566w0100000Te) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.39767 02 57 11.91 +09 01 42.1 16.4 Vro5016703 (JueAhg010000566w0100000Tf) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.40533 02 57 11.66 +09 01 37.1 16.5 Vro5016703 (JueAhg010000566w0100000Tg) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.41303 02 57 11.41 +09 01 31.8 16.4 Vro5016703 (JueAhg010000566w0100000Th) has been identified as (29149) and published in MPS 145016.
String formated output for input that includes malformed elements.¶
response = requests.get(url, json=["string", "5T0D452 703","bi#_%_&ldvfanoj48034803480"])
response.raise_for_status()
truncated_print(response.text)
29149 C2005 10 10.39002 02 57 12.16 +09 01 47.3 16.5 Vro5016703 (JueAhg010000566w0100000Te) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.39767 02 57 11.91 +09 01 42.1 16.4 Vro5016703 (JueAhg010000566w0100000Tf) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.40533 02 57 11.66 +09 01 37.1 16.5 Vro5016703 (JueAhg010000566w0100000Tg) has been identified as (29149) and published in MPS 145016. 29149 C2005 10 10.41303 02 57 11.41 +09 01 31.8 16.4 Vro5016703 (JueAhg010000566w0100000Th) has been identified as (29149) and published in MPS 145016. Note that one or more of your lines including "bi#_%_&ldvfanoj48034803480" could not be parsed as an obsid, trksub, submission_id, or submission_block_id.
Error Handling¶
The API returns standard HTTP status codes. Here is a simple pattern for handling errors.
bad_list = ["NotARealIdentifier12345"]
response = requests.get(url, json=bad_list)
print(f"Status code: {response.status_code}")
print(f"Response OK: {response.ok}")
try:
response.raise_for_status()
print(json.dumps(response.json(), indent=2))
except requests.exceptions.HTTPError as e:
print(f"Error: {e}")
Status code: 200
Response OK: True
{
"found": [],
"malformed": [
[
"NotARealIdentifier12345",
"Note that one or more of your lines including \"NotARealIdentifier12345\" could not be parsed as an obsid, trksub, submission_id, or submission_block_id."
]
],
"not_found": []
}
Summary¶
The WAMO API helps verify and inspect submitted observations. Key points:
- Endpoint:
https://data.minorplanetcenter.net/api/wamo - Method:
GETwith a JSON list payload - Identifier formats:
trkSub stn,obsid,obs80, or submission block ID - String output: include
"string"in the list to get the original WAMO text
For questions or feedback, contact the MPC via the Jira Helpdesk.