Sourabh
Sourabh

Reputation: 564

How do pass data binary (file data )as well as other parameters in json via curl

Have a table with an id and a clob field in database. Need is to implement a Post service to persist data for this table for which an entity is designed with @lob for (CLOB column String java type) and @id(ID) in db. I have designed a rest service which takes input in the format below- { id: input_id, data: clob_data }

How do we pass id and the contents of the file to get stored via rest and curl. Or if there is a better way to implement open for suggestions.

Upvotes: 0

Views: 223

Answers (1)

Craig McIlwee
Craig McIlwee

Reputation: 69

You could move the ID from the POST body to the URL. This would allow the POST body to just be the file content which would then allow a simple curl command like this:

curl -d @file_to_post https://<your_server>/path/to/service/<input_id>

Upvotes: 1

Related Questions