28

Argh! What are HTTP status codes for if you're not using them in your API implementation?!

Fucking morons!

Comments
  • 4
    We need details
  • 5
    @ThatDannyBoy not much to say really.

    I'm writing a wrapper for an external API that doesn't make use of HTTP status codes and always sets the status to 200 for different responses for the same API.

    I like to rely on status codes in my wrapper design to determine whether or not the request is successful and to return an error to the user in case an error occurs.
  • 6
    @rantsauce must be my company web services, let me complain and screech to them again
  • 1
  • 8
    200: {error: "You done screwed up."}

    Edit: @oreru's is better.
  • 4
    You are destroying the HTTP standard to be honest.
  • 4
    as a sufferer of shitty apis myself, I would hug you if I could...
  • 4
    Standards are not laws.
    Plus almost every Api I've ever connected to runs everything back with 200 and the error in the response message.
  • 1
    @halliFacks wtf
  • 1
    It can make sense to ignore HTTP status codes.
    For example, if you define your own custom protocol having its own status/return codes, HTTP becomes no more than a transport layer, replacable with multiple other protocols, some of them not having status codes at all.
    You CAN then translate your status codes to HTTP (if that's possible), but why should you do this extra work and build redundancies if you simply could check the protocol's status code at the first place?
  • 3
  • 2
    Slack API:
    200 { ok: false, error: not-authed }

    WELL THEN RETURN A FUCKING 401!!!
  • 0
    @GodlikeBlock this is exactly my situation.
  • 1
    what do browsers do when a page returns 418 I'm a Teapot?
  • 1
    @Parzi displaying the body
Add Comment