Implementing custom actions for your RESTful API

Implementing custom actions: use actions in the URL even if it’s not RESTful

Option 1: treat it as an attribute

PATCH /machine/1{
state: "on"
}

Option 2: use resources instead

POST /user/123/subscriptions

Option 3: use custom HTTP headers

POST /machine/1X-MyApi-MachineAction: "PowerOff"

Option 4: use actions in the URL anyways

--

--

--

Développeur web et passionné de finances personnelles

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to access to Raspberry Pi Desktop using the remote desktop protocol.

Square Root Decomposition

Five SOLID Principles

Good day! our new work is a picture for free distribution from our NFTPoligon project!

Axelar is your chance to earn money for a car.

Bridgeswap Weekly Recap, Don’t Miss anything !!!

Let the Global Weather Alerts flow into your IT system

Nestables Public Alpha

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Guillaume Viguier-Just

Guillaume Viguier-Just

Développeur web et passionné de finances personnelles

More from Medium

Getting started with MongoDB with node.js

MicroServices Made Simple with Moleculer

PERN Stack Todo App — Postgres, Express, React and Node (Backend)

script for the package.json file

Node.js Rest CRUD API with MySQL Part 1