Non-tabular API calls in a JSONAPI


I have a JSONAPI entering production, and it’s not at all bad. However, I need to solve a few things on the side, things that don’t really fit well into the tabular model.

For example, I have a users resource and users with about four attributes and five relationships, all very nice. But then I have “user forgot password, server should email a recovery URL at its early convenience”, which doesn’t fit at all.

I have another couple of things like that — things that simply aren’t tabular data, even though most of the API is. How have others attached such extra calls into a mostly-JSONAPI?

Maybe I’m too eager to get a harmonious result here.


Check out this thread: Representing Non-CRUD Actions in JSON API Payloads

I believe that my question was similar to yours and @A-Helberg did a great job explaining.


My guess would be to do something like /users/actions/password/new with data like this:

{ type: 'forgot-password' attributes: { email: ''} }