I want to call an API that has following request format:
curl -X POST -H "Content-Type: application/json" \
-H "api-key: API_KEY" \
-d '{"article":
{"body_markdown":"---\ntitle:A sample article about...\npublished:false\n---\n..."}}' \
<api-url>
I want to create the value of body_markdown
param in one .md
file. So I create tes.md
with following content:
---
title:A sample article about...
published:false
---
content is here
How to copy the content of tes.md
file to be a curl command line?
I have tried several way but it doesn't work
cat tes.md | curl -X POST -H 'Content-Type: application/json' -H 'api-key: <my-key>' --data '@tes.md' <api-url>
I also tried something like this
curl -X POST -H 'Content-Type: application/json' -H 'api-key: <my-key>' --data '@tes.md' <api-url>
this solution also didn't work.
Where did I do wrong?