
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
Galleries plugins for Wordpress
SEO plugins for Wordpress
Contact Form plugins for Wordpress
Forms plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Comments plugins for Wordpress
Portfolio plugins for Wordpress
Maps plugins for Wordpress
Security plugins for Wordpress
Translation plugins for Wordpress
Ads plugins for Wordpress
Video Player plugins for Wordpress
Music Player plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Chat plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Tabs plugins for Wordpress
Membership plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Inventory plugins for Wordpress
Video Player plugins for Wordpress
Testimonials plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Social Feeds plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Events Calendar plugins for Wordpress
Contact plugins for Wordpress
Comments plugins for Wordpress
Analytics 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.
Show product updates, new features, and announcements in a What's New popup that keeps users informed and engaged.
Add a logo slider to your site to showcase clients and partners, strengthen brand credibility, and build trust with new visitors.
Display locations with company branch flip cards that help customers find nearby offices, understand key details, and enjoy a smoother overall experience.
Show your latest TikTok videos in a live feed that keeps content fresh, builds social proof, and keeps visitors engaged.
Show YouTube videos with a YouTube slider that displays clips in a smooth, customizable layout to boost engagement.
Add a PDF viewer to your site to display documents, share product information, and give visitors easy access to helpful content in one place.
Add an Instagram slider to your site to display social posts dynamically and keep your visual content engaging and current.
Add interactive stories to your site to showcase content in a visual, mobile friendly format that boosts engagement and guides visitors toward action.
Showcase photos with an image stack gallery that layers images in a stacked display with smooth transitions to create a visually striking presentation.
Capture email leads with an email subscription form that collects addresses, saves entries, sends notifications, and helps grow your audience.
Show Google Play reviews for your Android app to build trust, strengthen credibility, and help visitors make confident download decisions.
Add collapsible content sections to your site to organize information and help users navigate content more efficiently.
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!
