Hello. I tried use Curl to add post on my site.
I’m used code from this example with my data:
# cURL
# Create a session, and store the cookie in ghost-cookie.txt
curl -c ghost-cookie.txt -d username=me@site.com -d password=secretpassword \
-H "Origin: https://myappsite.com" \
https://demo.ghost.io/ghost/api/v3/admin/session/
# Use the session cookie to create a post
curl -b ghost-cookie.txt \
-d '{"posts": [{"title": "Hello World"}]}' \
-H "Content-Type: application/json" \
-H "Origin: https://myappsite.com" \
https://demo.ghost.io/ghost/api/v3/admin/posts/
But I received error message in response
“Unexpected token u in JSON at position 0”
Full error text:
{“errors”:[{“message”:“Unexpected token u in JSON at position 0”,“context”:null,“type”:“InternalServerError”,“details”:null,“property”:null,“help”:null,“code”:null,“id”:“e5afecf0-0fb2-11ec-93a2-e394b58ea0c9”}]}
I tried to use just 2 post request:
- Receive cookie (work)
- With cookie add post on site (same error)