Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
devraj opened this issue Jul 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@devraj
Copy link
Member

devraj commented Jul 13, 2024

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.

@devraj devraj added the bug Something isn't working label Jul 13, 2024
@devraj devraj self-assigned this Jul 13, 2024
@devraj devraj added this to the alpha-finalisation milestone Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant