Home > Blockchain >  proper curl command for delete with > one word as the parameter
proper curl command for delete with > one word as the parameter

Time:07-30

I have a rest request like the following:

@DeleteMapping(value = "v1/delete/{id}")
public void deleteRecord(
        @PathVariable @NotBlank @Parameter(description = "id", required = true) String id) {
    service.deleteRecord(id);
}

the id is a String, and can have multiple words with spaces in between like

RO RE MI FA SO

I would like to construct a curl command that supports String with spaces, but I don't know how. Below does not pick up second word.

curl -k -X DELETE https://localhost:8080/v1/delete/DO RI     

grateful for ideas. Thanks

CodePudding user response:

The answer was provided by VGR. URLs cannot contain spaces, so I simply needed to URL encode the spaces in the parameter:

https://localhost:8080/v1/delete/DO RI

  • Related