Mule ESB APIKit REST DELETE Method- Can I force Mule to use the JSON body instead of the URI?

StackOverflow https://stackoverflow.com/questions/21391464

  •  03-10-2022
  •  | 
  •  

Вопрос

How can I grab the request body during a DELETE operation? The Mule Message payload is the URI instead of the JSON document that was sent by the client.

A little background

I defined a POST, PUT and DELETE operations in RAML and generated my Mule project using APIKit. The caller of the REST web service does not have the primary key, so it cannot be placed in the URI (I assume this is how the DELETE was intended to be used). The client does however have two other pieces of data that the Service layer uses to look-up the primary key and delete the record in the database.

I suppose I could just create two query parameters for the DELETE operation, but I would prefer to just pass a JSON document in the body.

Это было полезно?

Решение

Nothing in the HTTP spec prevents DELETE from carrying a request entity but it states:

The DELETE method requests that the origin server delete the resource identified by the Request-URI.

So your idea to use two query parameters sounds like the best option to me.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top