You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to sparse fieldsets & #159, what if we want to express sparse relationships in JSON API?
A resource might relate to many other resources. However, in fulfilling a request, it might be expensive to provide all of them. Consider that each relationship might require a table join in order to determine existence and resolve the public identifier. Or worse yet, an internal service-to-service API request.
We can express sparse relationships using a relationships parameter, with a notation similar to sparse fieldsets.
If relationships is not defined as a parameter, resource does not support sparse relationships and returns all of them if it has them.
If relationships is defined as a parameter:
It must be style: form, explode: false. This defines a comma-separated []string like ?relationships=a,b,c.
No relationship parameter present in the request means I'm not filtering relationships, so "give me everything"
?relationships= means "I don't want any relations at all" (empty or omitted relationships)
Similar to sparse fieldsets & #159, what if we want to express sparse relationships in JSON API?
A resource might relate to many other resources. However, in fulfilling a request, it might be expensive to provide all of them. Consider that each relationship might require a table join in order to determine existence and resolve the public identifier. Or worse yet, an internal service-to-service API request.
We can express sparse relationships using a
relationships
parameter, with a notation similar to sparse fieldsets.relationships
is not defined as a parameter, resource does not support sparse relationships and returns all of them if it has them.relationships
is defined as a parameter:style: form, explode: false
. This defines a comma-separated []string like ?relationships=a,b,c.?relationships=
means "I don't want any relations at all" (empty or omitted relationships)Given a resource like:
We might request a subset of these with
GET /some-resource/some-id?relationships=org,group
:or none at all with
GET /some-resource/some-id?relationships=
:The text was updated successfully, but these errors were encountered: