Skip to content

Reconsider use of DELETE HTTP Verb where the REST API has a remove operation for objects #56

@devraj

Description

@devraj

Describe the bug
I have been using the HTTP delete method to remove things like card assignments from a cardholder. While this works as expected, I noticed that the PATCH verb supports update, remove operations which allows extra attributes like status where we can provide reasons for the change.

  "cards": {
    "add": [
      {
        "type": {
          "href": "https://localhost:8904/api/card_types/354"
        },
        "pin": "153624"
      },
      {
        "type": {
          "href": "https://localhost:8904/api/card_types/600"
        },
        "number": "Jock's iPhone 8",
        "status": {
          "value": "Pending sign-off"
        },
        "invitation": {
          "email": "[email protected]"
        }
      }
    ],
    "update": [
      {
        "href": "https://localhost:8904/api/cardholders/325/cards/97b6a24ard6d4500a9d",
        "issueLevel": 2,
        "until": "",
        "status": {
          "value": "Stolen"
        },
        "pin": "153624"
      }
    ],
    "remove": [
      {
        "href": "https://localhost:8904/api/cardholders/325/cards/77e8affe7c7e4b56",
        "status": {
          "value": "Lost"
        }
      }
    ]
  },

To Reproduce
Not quite applicable, attempt sending the same payload via HTTP delete method vs http patch.

Expected behavior

  • Using DELETE does not leave a trace
  • Using PATCH should perform the same operation but leave an event log

Screenshots
NA

Desktop (please complete the following information):
NA

Smartphone (please complete the following information):
NA

Additional context
See REST docs.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions