docs-v2 icon indicating copy to clipboard operation
docs-v2 copied to clipboard

Addition of Examples & Use Cases

Open royboy789 opened this issue 10 years ago • 5 comments

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

royboy789 avatar Sep 11 '15 17:09 royboy789

If you have examples, please link me to articles / themes / plugins with code

royboy789 avatar Sep 11 '15 17:09 royboy789

Create Simple example one every Reference page (as needed) with further detailed in own page with link.

royboy789 avatar Sep 23 '15 18:09 royboy789

Starting to get some examples in, and checking formatting or if we want to go tabbed interface - https://github.com/WP-API/docs-v2/pull/51

royboy789 avatar Sep 23 '15 20:09 royboy789

I think it would be important to have a generic example of calling arguments, such as:

http://demo.wp-api.org/wp-json/wp/v2/posts/?filter[ARG_NAME]=ARG_OPTION

This could be a simple line underneath the 'Arguments' heading.

Additionally, this same type of documentation could be applied to several other sections, such as Schema. Right now, all of these areas seem a little vague in their actual usage in an api call.

I hope this is the proper place to post this idea. If there is a better protocol, let me know!

baerkins avatar Mar 01 '16 18:03 baerkins

@royboy789 , I have a demo plugin that shows how to do an upload to the media library from the front-end (user must be logged in and have the upload_files capability). The plugin is tested with WP-API Version 2.0-beta13

The plugin is available at my site: https://soderlind.no/dropzonejs-wordpress-rest-api/

btw, here a similar demo that creates a custom endpoint: https://soderlind.no/dropzonejs-wordpress-rest-api-with-custom-endpoint/

soderlind avatar Apr 06 '16 20:04 soderlind