r-spacex / SpaceX-API

:rocket: Open Source REST API for SpaceX launch, rocket, core, capsule, starlink, launchpad, and landing pad data.
Apache License 2.0
10.43k stars 925 forks source link

Ideas for Expansion #1

Closed jakewmeyer closed 2 years ago

jakewmeyer commented 7 years ago

Please feel free to post any suggestions, corrections, or additions I should make to the data. I'll try my best to keep it as current as possible πŸ‘

Thanks!

quadrplax commented 7 years ago

https://api.spacexdata.com/upcoming Info for next three or so launches which have solid-ish NET dates.

jakewmeyer commented 7 years ago

Planning on adding tentative future launch data next.

Thanks for the feedback!

petrosh commented 7 years ago

Patches!!

jakewmeyer commented 7 years ago

Agreed on the patches 200% πŸ‘

Links to the original photos?

jakewmeyer commented 7 years ago

Patch links are now live! πŸ‘

jakewmeyer commented 7 years ago

@quadrplax I've added an endpoint for upcoming launches, I'll keep adding to it as we find out information.

https://api.spacexdata.com/launches/upcoming
jokecamp commented 7 years ago

It would be great to make links an array in a hypermedia inspired way. That way you could link a lot of different links like SpaceX instagram posts, gifs, videos, articles,

Something like

links: [ { type: 'video', url: '' }, { type: 'instagram', url: '' }, ]

jakewmeyer commented 7 years ago

@jokecamp Looking at a better way to express the data, so it allows for more flexibility going forward.

HarvsG commented 7 years ago

Not exactly sure of the usefulness, but perhaps links to Reddit launch threads and/or media threads? Perhaps as part of @jokecamp's suggestion for a 'links' object

jakewmeyer commented 7 years ago

@HarvsG I'll add it to the list for the links object

jakewmeyer commented 7 years ago

@jokecamp @HarvsG Now that I have a good way to add multiple links, I'll make a pass and add the reddit launch threads

Anything else media related that should be included?

jakewmeyer commented 7 years ago

Launches + Upcoming Launches now have links to reddit campaign, launch, recovery, and media threads, as well as official presskit PDF's put out by SpaceX πŸ‘

kfarr commented 7 years ago

This is a great data source, thanks for creating this! Curious if there is source for add'l info on the launches -- specifically looking for detailed info to create a 3d visualization of the launches.

jakewmeyer commented 7 years ago

@kfarr What kind of additional info?

kfarr commented 7 years ago

So the crazy idea is to make a visualization of the earth and the orbit in webvr. This would require at a minimum:

I don't know the right way to suggest providing this data but I think there would be interest in such a visualization and I'm happy to take a stab at it.

I suppose the "pareto superior" next step is to provide a landing position in addition to launch site in the data?

jakewmeyer commented 7 years ago

Awesome! I've been wanting to include more detailed telemetry, but haven't had a good way to make it happen easily until now. If we can nail down some specific info that we need, I can add a telemetry section to the flights for easier visualization and analysis.

The idea almost sounds like a VR version of Flight Club from @murphd37, which has super detailed trajectory and data simulations for lots of flights. He would be a good resource for information about the best way to go about it.

kfarr commented 7 years ago

Wow Flight Club is incredible, looks like @murphd37 has done the heavy lifting already on the visualization side. So, the missing element is simply linking these together? For example, here's the link to the "playback" view of Bulgaria Sat 1: https://www.flightclub.io/world/?w=2&code=BGS1

It could be yet another item in the link array, assuming that there is interest in visualizing these things ahead of the mission launch. I also don't know what info is released publicly prior to launch

jakewmeyer commented 7 years ago

I'll make a pass on the database and add the links for the launches @murphd37 added previously πŸ‘

waterskier2007 commented 7 years ago

Here's an idea for the rocket associated to each launch

Similar to how the launches have the launch site as:

"launch_site": { "site_id": "kwajalein_atoll", "site_name": "Kwajalein Atoll" }

You could have the rocket for each launch like:

"rocket": { "rocket_id": "falcon9", "rocket_name": "Falcon 9" }

This would allow lookups of rockets from the launch data

waterskier2007 commented 7 years ago

@jakewmeyer thoughts?

jakewmeyer commented 7 years ago

@waterskier2007 I'll add it to the list, hoping to add this and #31 today/tonight

waterskier2007 commented 7 years ago

πŸ‘Œyou da man

waterskier2007 commented 7 years ago

@jakewmeyer I see some of the launches are beginning to take the structure. I assume your plan is to do this for all launches?

waterskier2007 commented 7 years ago

@jakewmeyer also, just an FYI, the launches/cores/coreId and launches/caps/capId endpoints will have to be updated because the core_serial and cap_serial are no longer properties of the launches directly

jakewmeyer commented 7 years ago

@waterskier2007 I was fighting with the endpoints last night, and the query wasn't working as it should. So I just moved the serial numbers back out to the root of the object, so the endpoints don't have to be changed.

Everything should be updated at with the rocket name + info at this point πŸ‘

waterskier2007 commented 7 years ago

I’m not familiar with ruby but can’t you use dot syntax to filter by a child property?

Ex:

collection.find({rocket.core_serial: 'b1034'}

I wrote this on my phone so it may not be accurate.

Sent from my iPhone

On Aug 2, 2017, at 3:58 PM, Jake Meyer notifications@github.com wrote:

@waterskier2007 I was fighting with the endpoints last night, and the query wasn't working as it should. So I just moved the serial numbers back out to the root of the object, so the endpoints don't have to be changed.

Everything should be updated at with the rocket name + info at this point πŸ‘

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jakewmeyer commented 7 years ago

@waterskier2007 That's what I was trying to do, but translating it to Ruby syntax wasn't working properly. I'm pretty sure you can use the dot notation syntax or this style, but neither would work for me.

collection.find(rocket: {core_serial: "#{core}"}, projection: {_id: 0}).sort(rocket: {core_serial: 1})

or

collection.find({'rocket.core_serial': "#{core}"}, projection: {_id: 0}).sort('rocket.core_serial': 1})

In both cases it would work without the projection and sorting statements. Planning on taking another crack at it to see if I can make it work.

waterskier2007 commented 7 years ago

@jakewmeyer what is the projection necessary for? It seems like it's only to limit the fields returned, but wouldn't you want all of the fields?

again, my ruby knowledge here is mostly nil but I was just looking at the documentation here https://docs.mongodb.com/manual/reference/method/db.collection.find/

gravitylow commented 6 years ago

Does it make sense to sort launches by date by default?

jakewmeyer commented 6 years ago

@gravitylow What do you mean?

jeroenboumans commented 6 years ago

I agree with sorting/ordening. Could be useful to set a param in the api call, like so: ".../launches?order=desc".

Also I'd love to see some more mission details, like a title and maybe some meta data? For example the IRIDIUM-4 MISSION doesn't have a patch-image url right now. Launch is within 16 hours. Also the title Iridiium-4 isn't mentioned in any details yet:

...
"links": {
  "mission_patch": null,
  "reddit_campaign": "https://www.reddit.com/r/spacex/comments/7cgts7/iridium_next_constellation_mission_4_launch/",
  "reddit_launch": null,
  "reddit_recovery": null,
  "reddit_media": null,
  "presskit": null,
  "article_link": null,
  "video_link": null
},
"details": null
...

Update: I've also noticed the 23 dec launch of Iridium isn't updated. Would it help to have some people update the data?

jakewmeyer commented 6 years ago

Adding sorting support in #65

Edit: @jeroenboumans Sorting support is now live for past and upcoming launch endpoints using the following querystrings

order=asc for ascending order order=desc for descending order

waterskier2007 commented 6 years ago

The launchpad by ID should not return an array

example: https://api.spacexdata.com/v2/launchpads/ccafs_slc_40

Also, there should be the ability to get cap/core based on serial directly as a route param like above, not as a query parameter

jhpratt commented 6 years ago

@waterskier2007 I imagine the first part of that should be trivial to change by adding [0] to wherever the endpoint is defined.

jeroenboumans commented 6 years ago

@jhpratt that would be the workaround indeed. Though, I agree with @waterskier2007, an endpoint with an ID (not a param or search term) should return a single object. This is fixed for the capsule and rocket endpoints in #68.

waterskier2007 commented 6 years ago

@jhpratt Yeah I know the workaround, it's just more about consistency and following closer to a normal REST standard

@jeroenboumans any reason that it's fixed for capsules but not for cores?

jeroenboumans commented 6 years ago

@jhpratt I'm not sure. Best is to ask @jakewmeyer :)

waterskier2007 commented 6 years ago

yeah, it looks like it works for capsules but not for detailed capsules... seems like an inconsistency in my book

see here: https://github.com/r-spacex/SpaceX-API/wiki/Capsule-Detail

@jakewmeyer

jakewmeyer commented 6 years ago

I agree with @jeroenboumans that endpoints with an ID should only return the object needed. The Launchpad endpoint is the only one not following this, but should be a trivial fix.

@waterskier2007 I'll add routes with ID's for cores/caps

jakewmeyer commented 6 years ago

Changes are live @waterskier2007 @jeroenboumans

https://api.spacexdata.com/v2/parts/cores/B1041 https://api.spacexdata.com/v2/parts/caps/C113 https://api.spacexdata.com/v2/launchpads/ccafs_slc_40

Adding 404's for bad ID's shortly

waterskier2007 commented 6 years ago

@jakewmeyer you are the man

jeroenboumans commented 6 years ago

Thanks for the quick update @jakewmeyer! Will update my app tonight! πŸ‘

jhpratt commented 6 years ago

Proposed addition: block of each core.

This should be an easy one to add, given we can find enough data.

jakewmeyer commented 6 years ago

Saw that @jhpratt. Should be able to add to to launches and detailed core data

rafaelramalho19 commented 6 years ago

We should be able to fetch a certain launch information regardless of knowing it's from the past or an upcoming launch. Here's a PR with the fix πŸŽ‰ https://github.com/r-spacex/SpaceX-API/pull/74

ahatzz11 commented 6 years ago

First - awesome API! I’ve been having a lot of fun playing with this.

Second - I found a few unexpected ways of how the resources are managed and I think there could be some improvements for REST resources.

I expected to be able to get a specific launches info based on it’s ID (flight_number) as a resource through the path, e.g. https://api.spacexdata.com/v2/launches/58 would return the information for flight 58. This is possible as a query param, e.g. https://api.spacexdata.com/v2/launches?flight_number=58, but accessing the resource for flight 58 via the path seems to follow REST.

Continuing on, I also expected that the /launches resource would have all the launches. As of now I’m not able to get a future launch through this endpoint, e.g. https://api.spacexdata.com/v2/launches?flight_number=59 returns an empty array.

sidenote: I noticed the docs mention that an empty array is returned if no match is found through querystring filtering. If the API moved to the resource being found through the path, that could return a 404 if the resource wasn’t found.

It would be a big change to the current contract, but /launches containing all launches and /launches/all being replaced with /launches/past would be great. I see the second path param adding the ability to narrow down the results:

I'm working on a PR to make some of these changes to see how it would work - still learning how to build/test locally.

Thanks for making this awesome API!

jakewmeyer commented 6 years ago

Glad you're enjoying it @ahatzz11 ! πŸ‘

  1. Not opposed to making it more in line with REST, but moving the resource filtering to query strings made it easier to handle edge cases and crazy filtering options people were looking for.

sidenote: This was a big point of debate for awhile, but it makes sense not to return 404, because the resource(aka. collection) is technically found, but no results were found.

  1. https://api.spacexdata.com/v2/launches?flight_number=59 returns flight 59 for me, not an empty array

  2. Originally launches held ALL the launches, but the upcoming ones were moved to a new collection for better separation of responsibility. This would be a major breaking change in the way the launches are currently delivered.

ahatzz11 commented 6 years ago
  1. The query filtering could stay in place, and getting a resource of a flight by ID could be an addition. Although a case like https://api.spacexdata.com/v2/launches/58?flight_number=58 might be weird if the path parameter didn't line up with the query parameter.

  2. When I wrote the comment yesterday with the flight 59 example, it didn't exist. Then SpaceX had their Falcon 9 launch yesterday and made my comment out of date! Hard to keep up with so many launches nowadays πŸš€

    An example that shouldn't go out of date soon: https://api.spacexdata.com/v2/launches?flight_number=100 returns an empty array.

  3. Interesting point here. I'll have to look more closely at how that's being managed.

Thanks for the speedy response here! (and on issue #82 regarding failing tests)

jakewmeyer commented 6 years ago
  1. Sounds good! Should make it more RESTful going forward.

  2. Gotcha πŸ‘

  3. We might be able to figure out a better name option while preserving backwards compatibility.

garyjacobs commented 6 years ago

Hey Jake, Thanks for this sweet API!

I was just wondering, with the mission patches, if it would be advantageous to have them in 2 sizes. The large size they are currently in and a smaller size - maybe half or more.

I'm having performance issues in scrolling a UICollectionView that is displaying a thumbnail of the images (which are actually rendered as full res and scaled down)

Not sure anything can be done but it's a long shot request.