Title: [Plugin: JSON API] posting through API via curl
Last modified: August 20, 2016

---

# [Plugin: JSON API] posting through API via curl

 *  Resolved [lego123](https://wordpress.org/support/users/lego123/)
 * (@lego123)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-posting-through-api-via-curl/)
 * First off, I would like to say that this plugin is the bomb! Anyways aside from
   it being so awesome, I’m having trouble using `create_post` method via curl in
   php. I have created a class to access the API via cURL and will will log me via
   curl if necessary. I seem to have all the cookies required for authentication
   in my cookie jar but I keep getting the following error from the API “You need
   to login with a user capable of creating posts”. Does anyone know why I keep 
   getting this error? I noticed that the `wordpress_logged_in cookie` is prefixed
   with `#HttpOnly_[domain]`, is it possible that curl ignores these values? If 
   cURL is ignoring this how can I resolve this issue? Any input is greatly appreciated,
   I need this working ASAP to complete a project.
 * [http://wordpress.org/extend/plugins/json-api/](http://wordpress.org/extend/plugins/json-api/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [lego123](https://wordpress.org/support/users/lego123/)
 * (@lego123)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-posting-through-api-via-curl/#post-3062288)
 * Nvm, I found the issue. I had to set `CURLOPT_COOKIEFILE` to the same file that`
   CURLOPT_COOKIEJAR` points to in order to transmit the cookies back to the server,
   then I had to set `CURLOPT_COOKIESESSION` to `false` in my curl settings. Everything
   seems to be working perfectly now.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: JSON API] posting through API via curl’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [lego123](https://wordpress.org/support/users/lego123/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-posting-through-api-via-curl/#post-3062288)
 * Status: resolved