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
{{ message }}
Repository navigation
Recommendation for empty to-one relationship related link #1134
@rpkilby My understanding is that what you're describing is actually the role of the relationship endpoint (i.e. the value of the self link, rather than the related one, which as I understand it, is supposed to point to the resource itself).
Sorry - wasn't entirely clear. The related resource link is useful because it allows you to use one request to both create a resource and then implicitly link it to the parent object. eg, you could POST /api/posts/3/author, which would create a new author resource and set it to the post's author relationship. Without the related link, you would need to use two requests.
POST /api/authorsPUT /api/posts/3/relationships/author
Activity
rpkilby commentedon Dec 21, 2016
We've preferred the second option, because you can still use that link to create the related resource and relationship linkage.
beauby commentedon Dec 22, 2016
@rpkilby My understanding is that what you're describing is actually the role of the relationship endpoint (i.e. the value of the
selflink, rather than therelatedone, which as I understand it, is supposed to point to the resource itself).rpkilby commentedon Dec 22, 2016
Sorry - wasn't entirely clear. The related resource link is useful because it allows you to use one request to both create a resource and then implicitly link it to the parent object. eg, you could
POST /api/posts/3/author, which would create a new author resource and set it to the post's author relationship. Without the related link, you would need to use two requests.#496 and #962 might be helpful.
beauby commentedon Dec 22, 2016
@rpkilby Thanks for the clarification, that makes sense. 👍