Title: Problem with REST API
Last modified: February 8, 2021

---

# Problem with REST API

 *  [dan400o6](https://wordpress.org/support/users/dan400o6/)
 * (@dan400o6)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-rest-api-5/)
 * Hi, so I’m trying to send a “POST” request via curl to my site, in order to create
   a new post.
 * My command:
    `curl -X POST --user "admin:admin" https://website.com/wp-json/wp/
   v2/posts/ -H "Content-Type: application/json" -d {"title":"test","content":"Content","
   status":"draft"}`
 * My response:
    `{"code":"rest_invalid_json","message":"Invalid JSON body passed.","
   data":{"status":400,"json_error_code":4,"json_error_message":"Syntax error"}}`
    -  This topic was modified 5 years, 3 months ago by [dan400o6](https://wordpress.org/support/users/dan400o6/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [plugin.builders](https://wordpress.org/support/users/pluginbuilders/)
 * (@pluginbuilders)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-rest-api-5/#post-14014223)
 * Try wrapping the data inside single quotes, like this: `-d '{"title":"test","
   content":"Content","status":"draft"}'`
 *  Thread Starter [dan400o6](https://wordpress.org/support/users/dan400o6/)
 * (@dan400o6)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-rest-api-5/#post-14016543)
 * [@pluginbuilders](https://wordpress.org/support/users/pluginbuilders/) I’ve tried
   that already I should’ve posted that. But I get the same error message regardless
   with quotes or not.
    -  This reply was modified 5 years, 3 months ago by [dan400o6](https://wordpress.org/support/users/dan400o6/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-rest-api-5/#post-14021023)
 * This topic is closed. Reposted at [https://wordpress.org/support/topic/error-when-i-try-to-create-post-via-api/](https://wordpress.org/support/topic/error-when-i-try-to-create-post-via-api/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem with REST API’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [curl](https://wordpress.org/support/topic-tag/curl/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-rest-api-5/#post-14021023)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
