Data Formats
Must: Use JSON as the Body Payload
JSON-encode the body payload. The JSON payload must follow RFC-7159 by having (if possible) a serialized object as the top-level structure, since it would allow for future extension. This also applies for collection resources where one naturally would assume an array.
Must: Use Standard Date and Time Formats
Read more about date and time format in Json Guideline.
Must: Use Standards for Country, Language and Currency Codes
Use the following standard formats for country, language and currency codes:
ISO 3166-1-alpha2 country codes
- (It is “GB”, not “UK”, even though “UK” has seen some use at HelloFresh)
-
- BCP-47 (based on ISO 639-1) for language variants
Could: Use other Media Types than JSON
If for given use case JSON does not make sense, for instance when providing attachments in form of PDFs, you should use another, more sufficient media type. But only do this if you can not transfer the information in JSON.
HTTP headers
Http headers including the proprietary headers. Use the HTTP date format defined in RFC 7231.