API date-time response is not compliant with RFC3339 API date-time response is...

Topic: API date-time response is not compliant with RFC3339

Post API date-time response is not compliant with RFC3339
by krenakzs on Friday, January 27, 2023

According to OpenAPI data type "date-time" should be in RFC3339 format (https://swagger.io/docs/specification/data-models/data-types/).
Example: 2018-05-08T14:52:11.52Z (Note the "Z" in the end)

The current API response truncates the timezone information, meaning the "Z" and everything that should come after it is missing.

Example:
curl -X GET "https://api.dynu.com/v2/dns" -H "accept: application/json" -H "API-Key: verysecurekey" | jq
...
"createdOn": "2022-06-16T06:13:42",
"updatedOn": "2023-01-27T10:30:01.77"

Note the missing "Z".

This causes issues when clients try to parse response according to standard. For example an openapi go client generated from your API spec will fail to parse any time field and will throw error on every response that contains such field.

Please fix the response implementation.

Reply with quote | Report
Thursday, November 21, 2024 10:32 PM
Loading...