Giter VIP home page Giter VIP logo

docs-v2's Introduction

WP REST API v2.0 (formerly known as WP-API)

Access your WordPress site's data through an easy-to-use HTTP REST API.

Development is no longer taking place in this repository.

  • For support requests, use the WordPress forums.
  • For bugs and patches, use WordPress core Trac. Be sure to include full details and reproduction steps about the issue you are experiencing, and ideally a patch with unit tests.

The "develop" branch is version 2 which represents the last "beta" versions of the plugin. Read the documentation to introduce yourself to endpoints, internal patterns, and implementation details.

The "master" branch represents the legacy version of the REST API.

About

WordPress is moving towards becoming a fully-fledged application framework, and we need new APIs. This project was born to create an easy-to-use, easy-to-understand and well-tested framework for creating these APIs, plus creating APIs for core.

This plugin provides an easy to use REST API, available via HTTP. Grab your site's data in simple JSON format, including users, posts, taxonomies and more. Retrieving or updating data is as simple as sending a HTTP request.

Want to get your site's posts? Simply send a GET request to /wp-json/wp/v2/posts. Update user with ID 4? Send a PUT request to /wp-json/wp/v2/users/4. Get the page with slug "about-me"? GET /wp-json/wp/v2/pages?slug=about-me. Get all posts with the search term "awesome"? GET /wp-json/wp/v2/posts?search=awesome. It's that easy.

The WordPress REST API exposes a simple yet easy interface to WP Query, the posts API, post meta API, users API, revisions API and many more. Chances are, if you can do it with WordPress, the API will let you do it.

The REST API also includes an easy-to-use JavaScript API based on Backbone models, allowing plugin and theme developers to get up and running without needing to know anything about the details of getting connected.

Check out our documentation for information on what's available in the API and how to use it. We've also got documentation on extending the API with extra data for plugin and theme developers!

The API code in this plugin is currently integrated into core WordPress starting in 4.7.

Development is no longer taking place in this repository.

  • For support requests, use the WordPress forums.
  • For bugs and patches, use WordPress core Trac. Be sure to include full details and reproduction steps about the issue you are experiencing, and ideally a patch with unit tests.

Quick Setup

Want to test out the WP REST API? The easiest way is just to install a recent version of WordPress (4.7 or later).

Testing

You can also set up a development environment to work on the API code.

See the instructions for running the WordPress PHPUnit test suite to get started.

Issue Tracking

All tickets for the project are being tracked on WordPress core Trac.

Some previous issues can be found on the issue tracker for this repository; however, now that development of the API has moved to core Trac, new issues should not be filed here.

Contributing

Want to get involved? Check out Contributing.md for details on submitting fixes and new features.

Security

We take the security of the API extremely seriously. If you think you've found a security issue with the API (whether information disclosure, privilege escalation, or another issue), we'd appreciate responsible disclosure as soon as possible.

To report a security issue, you can either email security[at]wordpress.org, or file an issue on HackerOne. We will attempt to give an initial response to security issues within 48 hours at most, however keep in mind that the team is distributed across various timezones, and delays may occur as we discuss internally.

(Please note: For testing, you should install a copy of the project and WordPress on your own server. Do not test on servers you do not own.)

License

GPLv2+

docs-v2's People

Contributors

aaronjorbin avatar be-webdesign avatar danielbachhuber avatar ericandrewlewis avatar fabacab avatar iandunn avatar jblz avatar jimt avatar joehoyle avatar johanmynhardt avatar jtsternberg avatar kadamwhite avatar kuldipem avatar luciaisacomputer avatar mantismamita avatar miya0001 avatar mrbobbybryant avatar natewr avatar nylen avatar oskosk avatar pollyplummer avatar quasel avatar rachelbaker avatar rmccue avatar shelob9 avatar shprink avatar solal avatar thenbrent avatar vimes1984 avatar wanecek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs-v2's Issues

Glossary for common terms

We should have a glossary for common terms (e.g. Resource, Controller, etc.) that can serve as an entry point to our documentation.

  • Resource
  • Controller
  • HTTP client
  • JSON parser
  • HEAD request
  • GET request
  • Routes
  • Endpoints
  • Meta Object
  • Class
  • Schema

Add documentation on how to run requests internally

For server side JavaScript rendering I want to call some of the API functions in PHP code. What is the best way to do this? For example, how can I fetch all the categories

xx/wp-json/wp/v2/categories

without a cURL request, but with normal PHP code within my WordPress plugin. Thanks!

Translation

Have any translation plan? How to contribute translating docs-vs of WP-API?

Meta endpoint clarifications

When we get around to adding documentation for the meta endpoints, we should mention:

  1. Meta endpoints are only registered if the post type supports custom-fields. If the post type doesn't, the endpoints need to be manually registered WP-API/WP-API#1637
  2. Developers would be better off to add attributes to their resource, than using meta endpoints.

Create tags docs

Now that categories and tags are treated differently, we should have endpoint documentation for tags too.

WP_API_Settings has changed to wpApiSettings

As of 11 January the WP_API_Settings localised javascript object has changed to wpApiSettings. This should be added to the "what's changed" section in the docs. (I'd add it myself, but I'm sure someone else will know better than me.)

Thanks!

Use absolute URLs for pages

While the single page effect is nice, it makes it painful to add links and negatively impacts SEO. Let's switch to absolute URLs. It's a static website, so pageloads should be fast enough.

Document the design decisions for our infrastructure classes

Our infrastructure classes are rich with history. Let's document why they exist, the problems they solve, and how they work:

  • WP_HTTP_Response
  • WP_HTTP_ResponseInterface
  • WP_JSON_DateTime
  • WP_JSON_Controller
  • WP_JSON_Request
  • WP_JSON_Response
  • WP_JSON_Server

Extending WP_REST_Posts_Controller

Hello

Can someone give me a link to a tutorial which deal with extending WP_REST_Posts_Controller

I need more control on the data return to my mobile app and add some other functions. The standard class doesn't.

Thanks a lot

Regards
Alexandre

Front page search param is incorrect

GET /wp-json/wp/v2/posts?s=awesome is incorrect, and the search query will be ignored.

GET /wp-json/wp/v2/posts?filter[s]=awesome is correct.

MIgration with old version

I need to support the old version urls because of backward compatibility (I use this API on android mobile application) and I want to add new features exist on v2 of wp-api to my new versions
but when I download v2 I can not access routes and I got error with code json_no_route
can you suggest a solution? or there is a way to change v2 api url from wp-json/wp/v2/ to something else

Add a "What Is A REST API?"

It's unsafe to assume that everyone reading the docs/ using the WordPress REST API knows what a REST API is. Hard to explain what the WordPress REST API is if you can't assume knowledge of REST APIs.

Docs should have a "What Is A REST API?" section that explains what such a thing is, in general and in the context of WordPress. I should write this. If someone else does first, +5 you.

Error when trying to serve documentation locally

I am getting this error when running jekyll serve:

Configuration file: /repos/wp-api/docs-v2/_config.yml
            Source: /repos/wp-api/docs-v2
       Destination: /repos/wp-api/docs-v2/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Dependency Error: Yikes! It looks like you don't have redcarpet or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- redcarpet' If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/! 
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting 'changes-beta-1.md':
                    redcarpet
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    redcarpet

Versions:

  • Ruby: 2.2.4p230
  • jekyll: 3.0.1
  • bundler: 1.11.2

Addition of Examples & Use Cases

Create a new section (with nav) sorted by language / framework. Each page (language/framework) should have at minimum the following examples:

  • GET - posts, posts with filter, custom post type
  • POST - creating a new post
  • UPDATE - editing a post
  • DELETE - deleting a post

Will start with:

  • PHP (WordPress focused)
  • jQuery
  • AngularJS
  • BackboneJS
  • ReactJS

OAuth example code referenced doesn't work and is outdated

On the Authentication page: http://v2.wp-api.org/guide/authentication/
Under "OAuth Authentication", an API Console: https://github.com/WP-API/api-console , is mentioned as a reference.

After spending a couple days trying to get it working, it became obvious to me that it wasn't designed for the v2 API, hasn't been updated in a year, and tries to do client-side authentication over OAuth sending a client key and secret in the clear from a JavaScript client.

I'd propose removing this reference link altogether as I don't feel it is a good starting place for people to learn how to use OAuth with the v2 API, and it teaches some really insecure practices that we should hope no one actually follows in their own application development.

Create a new post using REST API.

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==';

Cloud you add some plugins to "Compatible Plugins on the WordPress.org Plugin Repository"?

I made some Plugin that using WP REST API(v2).
Cloud you add following plugins to "Compatible Plugins on the WordPress.org Plugin Repository"?

WP API Shortcodes

Simple Shortcode Plugin to get WordPress data from WP REST API(Version2)
https://wordpress.org/plugins/wpapi-shortcode-and-widgets/

Rest API Widgets

This is simple Widget Plugin using WP REST API. You can use following Widgets.

thanks.

Document capabilities required for endpoints

It would be nice for the documentation to mention what capabilities are required to read/write to the various endpoints. Eg, it seems no capabilities are required to create a comment but that currently isn't documented

Document the search-replace --regex flag

There's currently no documentation on how the regex flag in the search-replace module functions, I noticed a bit of confusion on what it considers the replace element of the pattern, and what should be included (do you need the / wrappers to give flags to the pattern for example).

A documented block for this along with an example would be fantastic.

getting the posts without authentication also

Hi, just i set up my own wordpress site and wp-api v2 beta installed, im getting the users list when i go to this url myurl/wp-josn/wp/v2/users im getting the list as json im wondering this doesn't require an authentication like access token like that. I have also installed Oauth server plugin but no use of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.