How to Use Curl POST to Give Input from a File? Need Help!

18 Replies, 1381 Views

Hey everyone,

I’m trying to figure out how to use Curl POST give input from file, but I’m kinda stuck. I’ve got this JSON file, and I need to send its contents as the body of a POST request.

I tried something like:
`curl -X POST -d @data.json http://example.com/api`
But I’m not sure if this is the right way.

Does anyone know if this is correct? Or am I missing something? Also, do I need to add headers for JSON?

Any help would be awesome! Thanks in advance.

P.S. Sorry if this is a noob question, still getting the hang of curl. 😅

Messages In This Thread
How to Use Curl POST to Give Input from a File? Need Help! - by - 27-03-2024, 11:00 PM



Users browsing this thread: 1 Guest(s)