• Mak'@pawb.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    14 days ago

    …HTTP is a high level application protocol and its errors are supposed to be around access to resources…

    I’ve had fellow developers fight me on this point, in much the same way as your parent post.

    “If you return a 404 for a record not found, how will I know I have the right endpoint?”

    You’ll know you have the right endpoint because I advertised it—in Open API, in docs, etc.

    “But, if /users/123 returns a 404, does that mean that the endpoint can’t be found or the record can’t be found?”

    Doesn’t matter. That resource doesn’t exist. So, act appropriately.

    • Takumidesh@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      14 days ago

      It’s not like you can’t return a body with the 404 that specifies that the user itself is not found versus the ending being wrong.