Why would one prefer ISO 8601 dates over POSIX timestamps?
Edit: a relevant link
21–30 of 238 posts
Why would one prefer ISO 8601 dates over POSIX timestamps?
Edit: a relevant link
Why would one prefer ISO 8601 dates over POSIX timestamps?
* Supports birthdays for people older than 52
* Reliable after 2038
* Supports leap seconds
* HTML date/time spec is a subset
* String collation order matches temporal order
* Excel
Some nice tips in here. However, tip 15, I strongly disagree with: > 15. Allow expanding resources I would suggest the opposite. A REST API should not return nested resources at all. Instead, and to stay with the example provided on the website, to obtain the "orders", the /users/:id/orders endpoint should be called. It might be tempting to return nested resources, because clients would only have to make a single cal…
You want
GET /orders?user=Id
Orders can be searched on many dimensions, not inherent to users
Some nice tips in here. However, tip 15, I strongly disagree with: > 15. Allow expanding resources I would suggest the opposite. A REST API should not return nested resources at all. Instead, and to stay with the example provided on the website, to obtain the "orders", the /users/:id/orders endpoint should be called. It might be tempting to return nested resources, because clients would only have to make a single cal…
I've consumed the kinds of APIs you're referencing and they are my least favorite. I would prefer a poorly documented API over one that returns me 15 IDs that I must look up in separate calls. I think there's a reason those APIs also tend to have rate limits that are way too low to be useful.
Why would one prefer ISO 8601 dates over POSIX timestamps?
They can include a local timezone. Sometimes there's a big difference between 12am in UTC+0 and 3am in UTC+3 despite representing the same instant in time.
Mostly common-sense things, but I can't wait for the community to stop trying to use PUT, PATCH, DELETE and the like. There's a reason that in 2022 web forms only support GET and POST (and implicitly, HEAD).
Huh? There’s full browser support for all of those verbs. What is the argument for not supporting them?
The HTML forms only support GET and POST. Try it.
Earlier quoted context omitted.
I've consumed the kinds of APIs you're referencing and they are my least favorite. I would prefer a poorly documented API over one that returns me 15 IDs that I must look up in separate calls. I think there's a reason those APIs also tend to have rate limits that are way too low to be useful.
Quoted post unavailable.
Many rest apis are lazy and developer friendly, not consumer friendly.
If you have related resources, let’s say, product and product options as two distinct endpoints:
- /api/product
- /api/options
Then, and I want to be clear here, it is impossible for a client to perform an atomic operation on multiple distinct objects types.
Let’s say the client needs to add a product with a single option or fail.
You can create a product.
You can create an option.
You can add an option to a product.
…but, at some point in time, a product will exist with no options on it.
This kind of “pure” rest api is simply convenient to the developer because they push the problem of object consistency to the client.
…but that’s not a client concern.
If a product needs to be associated with an option on creation, then your api should offer that as an endpoint.
It doesn’t meet the “standard” for a rest api?
Too bad.
Write APIs that do what the customer / consumer needs not lazy APIs that just make your life easier.
I’ve worked with a lot of APIs and you know what I do not give the tiniest moment of care about?
Consistency.
I do. Not. Care. If POST /api/foo creates an object, or if the endpoint is /api/foo/create.
Messy? Inconsistent?
I don’t care. Just put it in the documentation and I’ll find it and use it.
…but if your api forces object relational consistency onto me as an api consumer, you have no idea how much pain and hassle you’ve caused me having to implement my own set of fake transactions over your stupid api.
Please, write APIs for consumers, not according to “the rules” of rest APIs.
…and provide documentation. :)
We don't use PATCH but use a PUT for partial objects. We have validator code at every endpoint and we validate both creates and updates. When a PUT comes in, the validator knows what can and can't be changed. Depending on your role, the validator lets you change certain things can be updated as well. A PATCH would need these too and now you have more code to deal with. Also, it requires the developer to now worry tha…
This is one reason why I don't bother with these methods and stick to GET and POST.