Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/cap issues #36

Closed
waterskier2007 opened this issue Jul 27, 2017 · 9 comments
Closed

core/cap issues #36

waterskier2007 opened this issue Jul 27, 2017 · 9 comments
Assignees

Comments

@waterskier2007
Copy link
Contributor

Sorry for all the issues being reported. This one's two parts

When fetching cap or core info for a single part (example: https://api.spacexdata.com/v1/parts/cores/B1036) it shouldn't return an array, just a single object

Also, the wiki entry for cap endpoints is incorrect. It lists the url as

https://api.spacexdata.com/v1/parts/caps/C106/

when it should be

https://api.spacexdata.com/v1/parts/caps/C106

as the first url produces an error

@jakewmeyer jakewmeyer self-assigned this Jul 27, 2017
@jakewmeyer
Copy link
Member

Wiki endpoint is corrected

Would it make sense to only return a single object though? Since there's the possibility for multiple results when you search all cores/caps, wouldn't that lead to inconsistency? Especially if more parameters are added to those endpoints in the future.

@waterskier2007
Copy link
Contributor Author

All caps/cores should return an array, but by definition, if you're getting a single cap/core, IMO it doesn't make sense to return an array, as a serial should point to a single result.

I'll leave it up to you :)

@HarvsG
Copy link

HarvsG commented Jul 27, 2017 via email

@waterskier2007
Copy link
Contributor Author

waterskier2007 commented Jul 27, 2017 via email

@waterskier2007
Copy link
Contributor Author

Here's an example of some endpoints taken from https://msdn.microsoft.com/en-us/library/dd203052.aspx

http://i.imgur.com/vLZirxn.jpg

Notice how the single object endpoints say "an individual..." vs. "a collection of..."

@HarvsG
Copy link

HarvsG commented Jul 27, 2017

Ok, I am with you now. Where the requester is expecting only a single object then it should not be an array. But in instances where the user is expecting 'one or more' objects it should always return an array even if there is only one object. E.g if it is a search term endpoint or something like launches/upcoming

@waterskier2007
Copy link
Contributor Author

@HarvsG absolutely. If it's a request for an unknown amount (0, 1, however many) it should (and kind of has to) be an array. But for the case where you're requesting a single object by ID (in this case core or cap serial) it should be a single object

@HarvsG
Copy link

HarvsG commented Jul 27, 2017 via email

waterskier2007 added a commit to waterskier2007/SpaceX-API that referenced this issue Jul 27, 2017
@jakewmeyer
Copy link
Member

Glad we all agree, I'll go ahead and merge 👍

jakewmeyer added a commit that referenced this issue Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants