Skip to content

Instantly share code, notes, and snippets.

@lcustodio
Last active October 25, 2017 12:50
Show Gist options
  • Save lcustodio/fc2e04e73d34fc7bc318d89bf9089f61 to your computer and use it in GitHub Desktop.
Save lcustodio/fc2e04e73d34fc7bc318d89bf9089f61 to your computer and use it in GitHub Desktop.
Api discussion

Option 1

POST

{
  "command": "SET_PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request",
    "newTargetDurationInMillis": "NULL | 0"
  }
}
  • How to know if the user is using the API properly?
  • We should notify if the user didn't sent newTargetDurationInMillis

Possible bad usage:

{
  "command": "SET_PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request",
    "newTargetDurationInMilli": 345345345
  }
}

-> This will remove the target duration... hard to know why.


Option 2

POST

{
  "command": "REMOVE_PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request"
  }
}
  • It's a command and follow the same "standard" with POST
  • Required the front to know that instead of sending empty, it should send another command.

Option 3

DELETE

{
  "command": "PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request"
  }
}
  • Same as previous, but sending with a delete verb.
  • However the resource is not deleted, just the property.

Option 4

DELETE

{
  "command": "PROCESS",
  "parameters": {
  	"processName": "New Vacation Request"
  }
}
  • DELETE verb to delete the Process resource.
  • Too easy to implement...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment