EDSM-NET / FrontEnd

Issues tracker for EDSM
https://www.edsm.net/
37 stars 0 forks source link

API Call - Get systems in a sphere radius - Returned data doesn't match documentation #414

Closed psdevil closed 3 years ago

psdevil commented 3 years ago

While I do not have an issue with the returned data, I just thought I'd post this as an anomaly.

In fact this is the only way to easily get the system body count.


When using this URL call today, the documentation said I should get back the following:

{
    distance    : 99.89,
    name        : "Pleiades Sector II-S b4-2",
    id          : 2069591,
    coords      : {
        x           : -177.03125,
        y           : -136.53125,
        z           : -329.75
    }
}

This is a snippet from my Python code:

import requests

systemName = 'Maia'
radius     = 50
minradius  = 0

requestData = {
    "systemName": systemName,
    "radius":     radius,
    "minRadius":  minradius
}

data = requests.get ("https://www.edsm.net/api-v1/sphere-systems", requestData)

The record format of what I actually get back is:

{
    distance    : 49.89,
    bodyCount   : 2,
    name        : "V1396 Cygni"
}

Not sure if this is a bug or just that the documentation hasn't been updated since the date on the webpage 6 Oct 2020 13:58:35.


This is a well designed and very useful website - please keep up the good work!

Tkael commented 3 years ago

I think you need to use the showId / showCoordinates / showPermit / showInformation / showPrimaryStar parameters if you want those details.

Maybe try something like this?

import requests

systemName = 'Maia'
radius     = 50
minradius  = 0
showcoordinates = 1
showid = 1

requestData = {
    "systemName": systemName,
    "radius":     radius,
    "minRadius":  minradius,
    "showCoordinates": showcoordinates,
    "showId": showid
}

data = requests.get ("https://www.edsm.net/api-v1/sphere-systems", requestData)

Should return the same data as this: https://www.edsm.net/api-v1/sphere-systems?systemName=Maia&radius=50&minRadius=0&showCoordinates=1&showId=1