Plugin Directory

Changeset 2091159


Ignore:
Timestamp:
05/20/2019 06:39:22 AM (7 years ago)
Author:
danielauener
Message:

simplified description

Location:
wuxt-headless-wp-api-extensions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wuxt-headless-wp-api-extensions/tags/1.0/readme.txt

    r2091111 r2091159  
    1414== Description ==
    1515
    16 The plugin is coded for [WUXT](https://github.com/northosts/wuxt), a dockerized
    17 development environment for headless WordPress combined with NuxtJs. However,
    18 it can be used by every other application, which needs a powerful headless
    19 WordPress back-end.
     16This plugin adds a couple of extensions to the WordPress Rest API, which are aimed to make the use of WordPress as headless CMS easier.
     17It is originally coded for [WUXT](https://github.com/northosts/wuxt), a dockerized development environment for headless WordPress combined with NuxtJs. However, it can be used by every other application, which needs a powerful headless WordPress back-end.
    2018
    21 **New endpoints**
     19=== WordPress API Extensions ===
     20
     21* **Frontpage endpoint**: There is no obvious way to get the WordPress front-page via the Rest API. To read the settings, you have to be authorized, which makes things unnecessary complicated. The new endpoint returns the front-page object if it is set, the ten newest posts otherwise.
     22* **Menu endpoint**: Right now, there is no way I know of, for getting menus from the API. This endpoint returns an entire menu as nested array. Default location is "main", but you can request other locations.
     23* **Slug endpoint**: If you are building a front-end app on top of WordPress, you have to think about how to structure your urls. WordPress has two default post-types (posts & pages) and in the urls is not distinguished which type you are requesting, so http://wp-site.expl/something might lead to a page or a post, dependent on the type of the object with the slug something. If you want to mirror that behaviour in your app, you have to do two requests for each url, one searching pages, one searching posts. To make that one request, use the slug end-point.
     24* **Taxonomy filter AND extension**: When filtering taxonomies with an Rest API request, all queries are OR-queries. That means you can get posts which are either in category A or B. Our adjustment lets you switch all tax_queries to an AND-relation, so that you can select posts which are both in category A and B.
     25* **Geo query**: If your application has to get posts by geographical proximity, you can use a geo query.
     26* **WordPress SEO meta fields**: They are included automatically in the <code>meta</code> object if the Yoast WordPress SEO plugin is activated.
     27* **Advanced custom fields** are included automatically in the <code>meta</code> object if the plugin is activated.
     28
     29=== Endpoints and parameters ===
     30
     31**Frontpage**
    2232
    2333* <code>GET</code> <code>/wp-json/wuxt/v1/front-page</code>
    2434* <code>GET</code> <code>/wp-json/wuxt/v1/front-page?_embed</code>
    2535
    26 There is no obvious way to get the WordPress front-page via the Rest API.
    27 To read the settings, you have to be authorized, which makes things unnecessary
    28 complicated. So here a custom endpoint for getting the front-page if it is set.
    29 The ten newest posts otherwise.
     36**Menu**
    3037
    3138* <code>GET</code> <code>/wp-json/wuxt/v1/menu</code>
    3239* <code>GET</code> <code>/wp-json/wuxt/v1/menu?location=&lt;location&gt;</code>
    3340
    34 Right now, there is no way I know of for getting menus from the API. This
    35 endpoint returns an entire menu as nested array. Default location is "main", but
    36 you can request other locations with the location parameter.
     41**Slug**
    3742
    3843* <code>GET</code> <code>/wp-json/wuxt/v1/slug/&lt;post-or-page-slug&gt;</code>
    3944* <code>GET</code> <code>/wp-json/wuxt/v1/slug/&lt;post-or-page-slug&gt;?_embed</code>
    4045
    41 If you are building a front-end app on top of WordPress, you have to think about
    42 how to structure your urls. WordPress has two default post-types (posts & pages)
    43 and in the urls is not distinguished which type you are requesting, so
    44 http://wp-site.expl/something might lead to a page or a post, dependent on the
    45 type of the object with the slug something. If you want to mirror that behaviour
    46 in your app, you have to do two requests for each url, one searching pages,
    47 one searching posts. To make that one request, use the slug end-point.
    48 
    49 **Enpoint extensions**
     46**Taxonomy filter AND extension**
    5047
    5148* <code>GET</code> <code>/wp-json/wp/v2/posts/?categories=1,2&and=true</code>
    5249
    53 When filtering taxonomies with an Rest API request, all queries are OR-queries,
    54 That means you can get posts which are either in category A or B. Our adjustment
    55 lets you switch all tax_queries to an AND-relation, so that you can select posts
    56 which are both in category A and B.
     50**GEO query**
    5751
    58 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat&gt;,&lt;lng&gt;&distance=&lt;distance&gt;</code>
    59 
    60 If your application has to get posts by geographical proximity, you can use these
    61 queries. The coordinates parameter has to contain lat and lng, comma-separated.
    62 The default meta-keys the query is comparing with are "lat" and "lng". If the
    63 values are saved in other meta-fields you can prefix the lat and lng values, like:
    64 <code>&lt;meta_key&gt;:&lt;coordinate&gt;</code>, e.g.
    65 <code>coordinates=lat_meta_key:52.585,lng_meta_key:13.373</code>. The distance
    66 parameter is in kilometers by default, use a "m" for miles after the distance
    67 value, e.g. <code>distance=13m</code>.
    68 
    69 * **WordPress SEO meta fields** are included automatically in the
    70 <code>meta</code> object if the plugin is activated.
    71 * **Advanced custom fields** are included automatically in the <code>meta</code>
    72 object if the plugin is activated.
     52* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat&gt;,&lt;lng&gt;&distance=&lt;distance&gt;&lt;km | m&gt;</code>
     53* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat_meta_field&gt;:&lt;lat&gt;,&lt;lng_meta_field&gt;:&lt;lng&gt;&distance=&lt;distance&gt;&lt;km | m&gt;</code>
     54* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10
     55* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=lat_mkey:52.585,lng_mkey:13.373&distance=10
     56* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10m
    7357
    7458== Installation ==
     
    10286= 1.0 =
    10387* Version 1.0 done
     88
  • wuxt-headless-wp-api-extensions/trunk/readme.txt

    r2091109 r2091159  
    1414== Description ==
    1515
    16 The plugin is coded for [WUXT](https://github.com/northosts/wuxt), a dockerized
    17 development environment for headless WordPress combined with NuxtJs. However,
    18 it can be used by every other application, which needs a powerful headless
    19 WordPress back-end.
     16This plugin adds a couple of extensions to the WordPress Rest API, which are aimed to make the use of WordPress as headless CMS easier.
     17It is originally coded for [WUXT](https://github.com/northosts/wuxt), a dockerized development environment for headless WordPress combined with NuxtJs. However, it can be used by every other application, which needs a powerful headless WordPress back-end.
    2018
    21 **New endpoints**
     19=== WordPress API Extensions ===
     20
     21* **Frontpage endpoint**: There is no obvious way to get the WordPress front-page via the Rest API. To read the settings, you have to be authorized, which makes things unnecessary complicated. The new endpoint returns the front-page object if it is set, the ten newest posts otherwise.
     22* **Menu endpoint**: Right now, there is no way I know of, for getting menus from the API. This endpoint returns an entire menu as nested array. Default location is "main", but you can request other locations.
     23* **Slug endpoint**: If you are building a front-end app on top of WordPress, you have to think about how to structure your urls. WordPress has two default post-types (posts & pages) and in the urls is not distinguished which type you are requesting, so http://wp-site.expl/something might lead to a page or a post, dependent on the type of the object with the slug something. If you want to mirror that behaviour in your app, you have to do two requests for each url, one searching pages, one searching posts. To make that one request, use the slug end-point.
     24* **Taxonomy filter AND extension**: When filtering taxonomies with an Rest API request, all queries are OR-queries. That means you can get posts which are either in category A or B. Our adjustment lets you switch all tax_queries to an AND-relation, so that you can select posts which are both in category A and B.
     25* **Geo query**: If your application has to get posts by geographical proximity, you can use a geo query.
     26* **WordPress SEO meta fields**: They are included automatically in the <code>meta</code> object if the Yoast WordPress SEO plugin is activated.
     27* **Advanced custom fields** are included automatically in the <code>meta</code> object if the plugin is activated.
     28
     29=== Endpoints and parameters ===
     30
     31**Frontpage**
    2232
    2333* <code>GET</code> <code>/wp-json/wuxt/v1/front-page</code>
    2434* <code>GET</code> <code>/wp-json/wuxt/v1/front-page?_embed</code>
    2535
    26 There is no obvious way to get the WordPress front-page via the Rest API.
    27 To read the settings, you have to be authorized, which makes things unnecessary
    28 complicated. So here a custom endpoint for getting the front-page if it is set.
    29 The ten newest posts otherwise.
     36**Menu**
    3037
    3138* <code>GET</code> <code>/wp-json/wuxt/v1/menu</code>
    3239* <code>GET</code> <code>/wp-json/wuxt/v1/menu?location=&lt;location&gt;</code>
    3340
    34 Right now, there is no way I know of for getting menus from the API. This
    35 endpoint returns an entire menu as nested array. Default location is "main", but
    36 you can request other locations with the location parameter.
     41**Slug**
    3742
    3843* <code>GET</code> <code>/wp-json/wuxt/v1/slug/&lt;post-or-page-slug&gt;</code>
    3944* <code>GET</code> <code>/wp-json/wuxt/v1/slug/&lt;post-or-page-slug&gt;?_embed</code>
    4045
    41 If you are building a front-end app on top of WordPress, you have to think about
    42 how to structure your urls. WordPress has two default post-types (posts & pages)
    43 and in the urls is not distinguished which type you are requesting, so
    44 http://wp-site.expl/something might lead to a page or a post, dependent on the
    45 type of the object with the slug something. If you want to mirror that behaviour
    46 in your app, you have to do two requests for each url, one searching pages,
    47 one searching posts. To make that one request, use the slug end-point.
    48 
    49 **Enpoint extensions**
     46**Taxonomy filter AND extension**
    5047
    5148* <code>GET</code> <code>/wp-json/wp/v2/posts/?categories=1,2&and=true</code>
    5249
    53 When filtering taxonomies with an Rest API request, all queries are OR-queries,
    54 That means you can get posts which are either in category A or B. Our adjustment
    55 lets you switch all tax_queries to an AND-relation, so that you can select posts
    56 which are both in category A and B.
     50**GEO query**
    5751
    58 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat&gt;,&lt;lng&gt;&distance=&lt;distance&gt;</code>
    59 
    60 If your application has to get posts by geographical proximity, you can use these
    61 queries. The coordinates parameter has to contain lat and lng, comma-separated.
    62 The default meta-keys the query is comparing with are "lat" and "lng". If the
    63 values are saved in other meta-fields you can prefix the lat and lng values, like:
    64 <code>&lt;meta_key&gt;:&lt;coordinate&gt;</code>, e.g.
    65 <code>coordinates=lat_meta_key:52.585,lng_meta_key:13.373</code>. The distance
    66 parameter is in kilometers by default, use a "m" for miles after the distance
    67 value, e.g. <code>distance=13m</code>.
    68 
    69 * **WordPress SEO meta fields** are included automatically in the
    70 <code>meta</code> object if the plugin is activated.
    71 * **Advanced custom fields** are included automatically in the <code>meta</code>
    72 object if the plugin is activated.
     52* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat&gt;,&lt;lng&gt;&distance=&lt;distance&gt;&lt;km | m&gt;</code>
     53* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=&lt;lat_meta_field&gt;:&lt;lat&gt;,&lt;lng_meta_field&gt;:&lt;lng&gt;&distance=&lt;distance&gt;&lt;km | m&gt;</code>
     54* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10
     55* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=lat_mkey:52.585,lng_mkey:13.373&distance=10
     56* <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=52.585,13.373&distance=10m
    7357
    7458== Installation ==
     
    10286= 1.0 =
    10387* Version 1.0 done
     88
Note: See TracChangeset for help on using the changeset viewer.