Link headers vs link elements for RESTful JSON

后端 未结 5 1606
余生分开走
余生分开走 2021-02-01 04:09

When building a RESTful / hypermedia API with JSON resources, it seems I have two options for specifying the hypermedia relationships between resources.

  1. Embed t

5条回答
  •  暖寄归人
    2021-02-01 04:36

    Go with a hypermedia JSON format. While Link Headers are standard, they're poorly adopted. They're really more valid for media formats that are not hypermedia. But since you have a choice and can choose a hypermedia format (unlike, say, PNG vs JPG), you should simply choose one and move forward.

    All of the JSON standard are bubbling about until one or another becomes a "de facto" standard. The more they're used, the more "de facto" they get.

    Seems to me that HAL is on a solid Standards track, and I would pick that.

    But either way, go with a hypermedia format because you can.

提交回复
热议问题