HACKER Q&A
📣 apiwhy

Why isn’t our API returning a timestamp?


We have a from which requires users to enter some data in certain formats, e.g. 1330 for a time - but it is assumed current day, next if it’s already passed. We calculate and store it as a DateTime.

I sat down and enumerated all the fields and what types I thought the API should return: an ISO 8602 timestamp; and others like a quantity as a number.

Other developers pick up the ticket to implement the work and now I’m looking at a pull request that has the API returning “1330” for the time and the quantity as a string “5”.

What am I supposed to do with this? I noticed and tried to convince them of my suggested specs but alas… “it will be easier for the front end to not to think about it and just dump the data straight to the form”. Whirl true… seems to miss the forest from the trees. What about any other system in the future? Waved off as hypothetical.

This is just but one trivial example, but am I out to lunch here or what? Am I being stubborn for expecting an API to return some sort of standardized data? Isn’t it the front ends job to format that data however it requires and not the other way around?

Seemingly failed to convince the team, do I need to ask management to break the standstill? Or do I just let this go and kick the can down the road?


  👤 ameyv Accepted Answer ✓
Better to ask on stackoverflow with code stub.