Peter Penzov
Peter Penzov

Reputation: 1646

Send values with curl

I have this POSTMAN configuration for sending values to Spring end point:

enter image description here

Spring endpoint:

@PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, value = "/v1/notification")
      public ResponseEntity<String> handleNotifications(@RequestBody MultiValueMap<String, Object> keyValuePairs) {

        LOGGER.debug("handleFormMessage");
        LOGGER.debug("keyValuePairs: {}", keyValuePairs);

        String unique_id = String.valueOf(keyValuePairs.get("uniqueid"));
        String status = String.valueOf(keyValuePairs.get("status"));
        String external_id = String.valueOf(keyValuePairs.get("external_id"));
        String gateway = String.valueOf(keyValuePairs.get("gateway"));
        String transaction_type = String.valueOf(keyValuePairs.get("transaction_type"));

        try {

          System.out.println("!!!!!");
          System.out.println("!!!! unique_id " + unique_id);

              System.out.println("!!!!! Entered if(paymentTransaction.isPresent()) {");

        } catch (Exception e) {
          e.printStackTrace();
          return new ResponseEntity<>("Please contact technical support!", HttpStatus.INTERNAL_SERVER_ERROR);
        }

        return new ResponseEntity<>(HttpStatus.OK);
      }

Is there a way to send the same data with curl?

Upvotes: 0

Views: 39

Answers (1)

Erez Ben Harush
Erez Ben Harush

Reputation: 855

Use postman's code button and select cURL: enter image description here

enter image description here

Upvotes: 1

Related Questions