I am having trouble understanding http://jsonapi.org/. Say, I have the following endpoints in my API for authors and articles.
/authors
/authors/:id/articles
If I wanted to fetch the details for a single article, I can use
/authors/:id/articles/:id
which returns data that looks like
{
"id": "1",
"type": "articles",
"data": {
"attributes": {
"title": "Programming in javascript.",
"body" : "Some long text here..."
},
"relationships": {
"author": {
"data": {
"id": "2",
"type": "authors"
},
"links": {
"self": "http://api.com/authors/2"
}
}
}
}
}
Now, if I want to update this article and change the author, the spec says I should use a PATCH. Should this PATCH request be made to
/authors/:id/articles/:id
/authors/:id/articles/:id/relationships/author
or
/articles/:id
/articles/:id/relationships/author