Skip to content

dev-yohan/wordpress_v2_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wordpress V2 API wrapper

Ruby gem to consume wordpress REST API V2: http://v2.wp-api.org/

Gem Version Code Climate Test Coverage Issue Count

Requirements

  • httparty >= 0.13.7, ~> 0.13

Configuration

config = WpApi::Configuration.new
config.base_uri = <your_site_base_uri>
config.options  = {
  http_proxyaddr: <your_proxy_address>,
  http_proxyport: <your_proxy_port>
}
WpApi.configuration = config

API Reference

http://v2.wp-api.org/reference/

Examples

Retrieve all posts

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts')

Paginate posts

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts', {query:{page:1, per_page: 10}})

Retrieve specific post

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts/<post_id>')

Retrieve all categories

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories')

Paginate categories

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories', {query:{page:1, per_page: 10}})

Retrieve specific category

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories/<category_id>')

About

Ruby gem to consume wordpress REST API V2: http://v2.wp-api.org/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages