Coder Social home page Coder Social logo

Comments (9)

bjeanes avatar bjeanes commented on September 23, 2024

I particularly like "no values in keys" which makes me think of the Heroku config var endpoint (the key in that hash is an important value).

from http-api-design.

geemus avatar geemus commented on September 23, 2024

Yeah, I certainly agree with the point (and agree that config-vars are BUSTED).

from http-api-design.

snowwolf007cn avatar snowwolf007cn commented on September 23, 2024

This section 'Programtic REST' is not a good choice. I think in header is better by the way of content-negotiation.

from http-api-design.

bjeanes avatar bjeanes commented on September 23, 2024

My friend @chendo pointed out an interesting use case for putting the version (and I suppose the content type) in the URL: if your API is to be consumed by semi-technical or non-technical people (e.g. integrations with IFTTT/Zapier), having a valid request be trivially valid with nothing but the URL isn't worthless. Nonetheless, for most APIs I think the choices outlined in our design guide are a better starting point.

from http-api-design.

snowwolf007cn avatar snowwolf007cn commented on September 23, 2024

The best way to deal with such occasion is to provide them with a SDK.

from http-api-design.

frankieroberto avatar frankieroberto commented on September 23, 2024

@snowwolf007cn or at the very least, the code for a curl or XMLHttpRequest.

That said, I think there's also some benefits to not requiring a version identifier in an HTTP header – for one thing, it means you can link to GET requests and they'll work in a browser.

The .json and .xml suffixes are a fairly widespread convention now too, and FWIW I don't think they're especially un-RESTful (especially if used alongside a non-suffixed version which uses content-negotiation).

from http-api-design.

geemus avatar geemus commented on September 23, 2024

I think header for version is still the best default. If it needs to be in the path (for the reasons stated) I think allowing a way to pass it in the query string (similar to how method override works) is a cleaner way to keep it separate but in the URL (vs putting it in host/path). What do you guys think?

Also, updating the title on this. I meant "main points" not "key points" per se. ie I think there are a few decent things in there, not just the keys/values stuff, just wanted to clarify.

from http-api-design.

frankieroberto avatar frankieroberto commented on September 23, 2024

@geemus allowing an override in the querystring seems like a reasonable compromise. However I do think there's a reasonable argument for either not-versioning an API, or allowing requests with no version stated to default to the 'latest' one.

from http-api-design.

geemus avatar geemus commented on September 23, 2024

@frankieroberto Yeah, I've gone back and forth about that. I think the only case in which I would say it was ok is if there was no versioning (which I'm not sure is tenable). Otherwise you have the situation you describe, where default is latest, which I feel like is problematic because it means that for end users the API could change on them at any time (between two requests even). By requiring the specificity, you avoid surprises (kind of like specifying dependencies in other software, you usually don't just let it update in between web requests or between tests or what have you). Does that help/make sense?

from http-api-design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.