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

Use content negotiation to determine output format #25

Closed
bruth opened this issue May 22, 2015 · 3 comments
Closed

Use content negotiation to determine output format #25

bruth opened this issue May 22, 2015 · 3 comments
Assignees

Comments

@bruth
Copy link
Contributor

bruth commented May 22, 2015

The order precedence is:

  • Accept header e.g. Accept: application/json
  • Extension on URL, e.g. /models/pcornet/v1.html
@bruth bruth self-assigned this May 22, 2015
@gracebrownecodes
Copy link
Contributor

It would make a lot of sense to me if rather than having a separate path for json with api/ prepended, all the file types existed at the same endpoints and could be requested either by Accept header, file extension, or url query parameter. I imagine this precedence:

  • Missing all parameters returns html.
  • Accept header precedes file extension precedes url query parameter.
  • md and markdown are synonyms.

This would also remove the need for the current index page and likely promote the models page to the index position.

@bruth
Copy link
Contributor Author

bruth commented May 22, 2015

Yes this ticket was intended to converge the endpoints, at the least the common ones. The API itself will be eventually be self-describing (via the Link header) and have more granular and composite resources (such as #18).

@bruth bruth closed this as completed May 26, 2015
@bruth
Copy link
Contributor Author

bruth commented May 26, 2015

I left off support for a file extension since I do not see it adding any value compared to the format URL parameter.

bruth added a commit that referenced this issue May 26, 2015
The representation format will be detected from the Accept header or
a URL parameter.

Fix #25

Signed-off-by: Byron Ruth <b@devel.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants