449
you are viewing a single comment's thread
view the rest of the comments
[-] jballs@sh.itjust.works 4 points 4 months ago

The problem I ran into was the response returned a JSON body, but then had an "error" attribute that was returned in it that had the error details. So we were parsing the JSON and loading elements into our database. We were hitting the API passing in a datetime of when the last success job was run, so basically saying "give me everything that's changed since I last called you."

So yeah, eventually we noticed we were missing small chunks of data. It turned out that every time the API errored out, we'd get a valid JSON response that contained the error message, but it didn't have the attributes we were looking for. So didn't load anything, but updated our timestamp to say when our last successful call was.

Huge pain in the ass to troubleshoot, because the missing data was scattered with no distinguiable pattern.

[-] calcopiritus@lemmy.world 2 points 4 months ago

Why not respond with the appropriate HTTP Code, and then also put the same code in the json?

[-] jballs@sh.itjust.works 2 points 4 months ago

That would have been fine for me too. I don't own the API, so I can only speak from a consumer perspective in saying: I don't want a HTTP 200 if my request didn't succeed.

this post was submitted on 11 Jun 2024
449 points (99.1% liked)

Programmer Humor

19503 readers
1271 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS