I have problem with sending POST request by curl command.
@RequestMapping(value = "/abc/def/{parameter}/enum", method = RequestMethod.POST)
public ResponseEntity<classA> function(@PathVariable(value = "parameter") int parameter, @RequestBody String parameter2) {
a = list.get(parameter);
a.setParameter(enumA.getValue(parameter2));
ResponseEntity<classA> response = new ResponseEntity<>(a, HttpStatus.OK);
return response;
}
Then i want to send POST by curl command:
curl -H "Content-Type: application/json" -X POST -d '{"parameter2" : "enum"}' https://user:password@localhost:port/abc/def/1/enum -k
I get response:
{"timestamp":123456789,"status":403,"error":"Forbidden","message":"Expected CSRF token not found. Has your session expired?","path":"/abc/def/1/enum/"}
Ideas?
curl -H "Content-Type: application/json" -X POST -d '{"parameter2" : "enum"}' -u username:password https://localhost:port/abc/def/1/enum