WP-API / docs-v2

Documentation for version 2 of the API
http://v2.wp-api.org
58 stars 76 forks source link

Create a new post using REST API. #133

Closed vikas009 closed 8 years ago

vikas009 commented 8 years ago

Hi I try to make a app using AngualrJs and Ionic with wordpress REST API. In this app get the data from wordpress using wordpress REST API,

Now i try to create a new post through my app using REST API.

Its Give me the errror

{"code":"rest_cannot_create","message":"Sorry, you are not allowed to create new posts.","data":{"status":401}}

I also pass the header to and convert username and password to base64(YmxvYWdZXI6czdWx0QCNAIQ==) formet

$http call $http.defaults.headers.common.Authorization = 'Basic YmxvYWdZXI6czdWx0QCNAIQ==';

danielbachhuber commented 8 years ago

You'll need to install and activate the Basic Auth plugin in order to use Basic Auth. The WP REST API plugin only supports cookie auth out of the box.

vikas009 commented 8 years ago

Hi thank for reply , I install the Basic Auth plugin in my wordpress .

Now i am facing same error

{"code":"rest_cannot_create","message":"Sorry, you are not allowed to create new posts.","data":{"status":401}}

Can you guide me some blog or Example for this?