0

We have a small spring boot application which has REST API as follows.

@RestController
@RequestMapping("/import")

@PostMapping(value="import")
public ResponseEntity<String> importData(@RequestParam("file") MultipartFile file, @RequestParam("sType") String sType, 
        @RequestParam("CCName") String CCName) throws Exception {

This does not accept form data as it is not defined in the API. Any suggestion on how to send data using curl command?

1
  • add your curl command Commented Sep 29, 2018 at 19:40

1 Answer 1

1

Take a look at -F option in curl (link).

For the controller that you have, the following curl works.

curl -X POST "http://localhost:8080/import" -F sType=sometype -F CCName=someccname -F file=@/path/to/file
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.