Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3641

Curl command for Rest POST API with Map

$
0
0

If we need to call REST API with Map<String, Object> as a request Parameter in curl command, how to pass a Map<String, Object>, i tried like:

@PostMapping("/abc/aa/{type}")    private final ResponseEntity<Void> invoke(@PathVariable String type,            @RequestParam(name = "params", required = false) Map<String, Object> params)    {    }

Curl command like:

curl -G -X POST --url http://localhost:8585/abc/aa/default_aa.TEST_varchar100_94946640?params='apiTriggered=true;fromPk=7898989898'

but it throws error:

{"success":false,"header":null,"data":null,"messageKey":"error.500","message":"error.500","errors":[],"exceptions":[{"messageData":{},"resource":"Throwable","messageKey":"Throwable","message":"Internal exception was caught and handled by CustomErrorController (see logs for the trace); UID: ad4e6165-7eed-4682-b587-bca6a6b2532e; message: org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Map'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Map': no matching editors or conversion strategy found","stackTrace"any samples for a REST API with Map as a parameter - and curl command for the same will help me.

I tried passing params like:

curl -G -X POST --url http://localhost:8585/abc/aa/default_aa.TEST_varchar100_94946640?apiTriggered=true&fromPk=7898989898

params(map) is not holding these values, map shows as null.

some people closes question, before closing please mention what extra information is expected.


Viewing all articles
Browse latest Browse all 3641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>