As more and more developers turn towards front-end apps and data solutions, a solid AJAX API is key to developing
a responsive, usable system of querying and modifying posts. While many solutions and plugins exist to help set up
endpoints, often times they are cumbersome or overly opinionated. Simple Posts API provides your site with an easy-to-use,
structure RESTful API with which to query, update, and delete posts. It is relatively unopinionated, so you can store and retrieve
post metadata at will without worrying about setting up fields beforehand. Additionally, it employs native WordPress Nonces
to provide a secure structure for updating your post data.
There are four main operations you can use with this plugin:
Each operation can be accessed by visiting http://yoururl.com/postsapi/OPERATION/POST_TYPE||ID You may pass a Post Type or ID as the second URL parameter depending on the operation you’re performing.
Each call must have a POST body containing a variable (nonce) containing a nonce value which WordPress will verify. There is a localized JS variable provided named secure which should be used. Some calls also allow other POST fields to be sent along with the call.
For calls which include Field data, the plugin will automatically determine which are Custom Fields and which are not.
See below for specifics on each operation.
Retrieve a list of posts based on a provided Post Type or Post ID.
URL Path
http://yoururl.com/postsapi/get/POST_TYPE
OR
http://yoururl.com/postapi/get/ID
POST Body
Required:
Optional:
Example POST body:
jQuery.post( '/postsapi/get/post', { nonce: secure, arguments : {'posts_per_page': '-1'} }) .done(function( data ) { console.log(data); });
Additional Notes:
The GET function returns author information for each post. If a user is logged in and has admin capabilities, the author information is extensive. If the user is not an admin, then any private information is stripped from the returned object for security purposes.
Update a post based on the provided ID and POSTed fields
URL Path
http://yoururl.com/postapi/put/ID
POST Body
Required:
Optional:
Example POST body:
jQuery.post( '/postsapi/put/1', { nonce: secure, force: false, fields: { 'post_title': 'Updated Title', 'custom_text': 'Updated custom text' } } ) .done(function( data ) { console.log( data ); });
Delete a post based on the provided ID
URL Path
http://yoururl.com/postapi/delete/ID
POST Body
Required:
Optional:
Example POST body:
jQuery.post( '/postsapi/delete/7', { nonce: secure, force: false } ) .done(function( data ) { console.log( data ); });
Create a post of the given post type, including the provided fields
URL Path
http://yoururl.com/postapi/post/POST_TYPE
POST Body
Required:
Optional:
Example POST body:
jQuery.post( '/postsapi/post/post', { nonce: secure, fields: { 'post_title': 'New Title', 'custom_text': 'New custom text', 'post_status': 'publish' } } ) .done(function( data ) { console.log( data ); });
Each call will return a JSON object. Within the JSON object is a key named status. This contains a status code and status message. You can check against this in your scripts in order to see if the call was successful or not. Any status code other than 200 is an error.
Each operation has its own unique _before and _after actions that can be hooked into. See below for a complete list.
GET
PUT
DELETE
POST
Starting from $0 per month.
Rating
Reviewers
No reviews
Tags
Developed By
mr_speer
Quick & Easy
Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!
Testimonial plugins for Wordpress
Contact Form plugins for Wordpress
Maps plugins for Wordpress
Translation plugins for Wordpress
Chat plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Contact plugins for Wordpress
Galleries plugins for Wordpress
SEO plugins for Wordpress
Forms plugins for Wordpress
Comments plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Comments plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Portfolio plugins for Wordpress
Video Player plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Inventory plugins for Wordpress
Testimonials plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Analytics plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Security plugins for Wordpress
Ads plugins for Wordpress
Music Player plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Membership plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Video Player plugins for Wordpress
Tabs plugins for Wordpress
Social Feeds plugins for Wordpress
Common Ninja Apps
Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.
Showcase Your Vimeo Videos in a Stunning Carousel
Revolutionize form creation effortlessly
Improve visibility & Increase attendance with the Events List Widget
Display fresh Reddit content effortlessly with customizable feeds.
Boost Your Site's Trust and Engagement with Social Proof
Create Stunning Facebook Feeds & Improve User Experience
Increase Trust & Improve Credibility To Drive Sales Up
Build Fun and Custom Leaderboards to Boost Competition
Enhance Customer Experience With the Company Branch List App
Turn Complex Data into Engaging, Interactive Infographics
Simplify the Checkout Process and Boost Sales
Showcase Videos, Enhance Design & Increase Conversions
More plugins
The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!