Opinion about describing behaivours (actions) in links section


#1

What is general opinion about describing some resource behaviors into link section, something similar to “actions” concept in Siren ?

So, for example, if resource could be exported, to point to that in a link section like this ?

“links”: [
{
“href”: “users/123/export”,
“meta” : {
“name”: “export”,
“type” : “action”,
“title”: “Export user”,
“method”: “POST”,
“parameters”: [
{ “name”: “fields”, “type”: “array”},
{ “name”: “exportType”, “type”: "string”}
{“name”: “exportSetting”, “type” : “number” }
]
}
}

What do you think about this approach, and if it is not right than what is suggestion for describing possible non standard actions for the resource ?


#2

Take a look at https://github.com/json-api/json-api/issues/745.

Basically, we don’t have official support for this yet, but what you’ve suggested above is a decent solution to use in the interim. Fixing this stuff is on the agenda for 1.2.


#3

Thanks. I’ve read conversation from link. I will share my further investigations and look forward to see on which way it will be officially included in json api.