mattsmith5
mattsmith5

Reputation: 1133

JSON API Restful Specs for Active Effective End Dates

Is there a standard protocol in JSON Rest Apis for getting Effective Start and specifically End Dates? Say a gym membership is currently active. Should JSON display Effective End Date be 12/31/9999 or null?

Trying to look at different API Specs.

I know in SQL they argue for 12/31/9999, 12/30/9999, and null. Not sure if API standards are different.

https://jsonapi.org/format/

trying to look at different stack articles: Recommended date format for REST GET API

Upvotes: 1

Views: 75

Answers (1)

James Risner
James Risner

Reputation: 6094

I’d use these Defaults for formatting. Ultimately it comes down to how you wish to design the API. Changing it later will be very difficult to the point of needing an entirely new API version.

If I were to design this, I’d choose the RFC3339 format:

YYYY-MM-ddTHH:mm:ss.ss±hh:mm

Drop Time if you believe you will never need or do 11:59 and 59 seconds if you wish.

For the case of End date, I’d use NULL.

Upvotes: 1

Related Questions