What is the best JSON schema to use for a collection of HTTP links?

天涯浪子 提交于 2019-12-25 01:12:19

问题


Given an API that returns a set of HTTP links, what JSON format or formats should be used to represent the resource?

RFC6690 describes application/link-format for a collection of links.

What JSON format or formats are appropriate for representing a collection of links as JSON instead?

Obviously we could invent one but it would be better to adopt a standard or de-facto standard.

I have come across several competing/overlapping standards including (in order of my perception of their popularity):

  • HAL+JSON and
  • JSON-LD
  • Collection+JSON
  • OData

How popular are these compared to each other and application/link-format? Does anyone routinely use application/link-format (link headers are of course very common)?

There are some blog entries on the subject:

  • https://www.mnot.net/blog/2011/11/25/linking_in_json
  • https://sookocheff.com/post/api/on-choosing-a-hypermedia-format/
  • https://evertpot.com/json-links/

and a few relevant SO questions:

  • What is the best practice for referencing JSON Schema for your state representations in REST?
  • Link headers vs link elements for RESTful JSON

来源:https://stackoverflow.com/questions/59270469/what-is-the-best-json-schema-to-use-for-a-collection-of-http-links

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!