curl --request POST \
--url https://api.example.com/api/create_post \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>"
}
'{
"message": "<string>"
}Create a new post with content up to 512 characters
curl --request POST \
--url https://api.example.com/api/create_post \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>"
}
'{
"message": "<string>"
}POST /api/create_post
201 Created
{
"message": "post created"
}
400 Bad Request
{
"error": "nothing to post"
}
content field is empty or missing.
{
"error": "post content cannot exceed 512 characters"
}
401 Unauthorized
{
"error": "invalid token , please re-login"
}
{
"error": "unauthorized"
}
curl -X POST https://api.example.com/api/create_post \
-H "Authorization: your-auth-token" \
-H "Content-Type: application/json" \
-d '{
"content": "This is my first post!"
}'
{
"message": "post created"
}