Changeset 2091159
- Timestamp:
- 05/20/2019 06:39:22 AM (7 years ago)
- Location:
- wuxt-headless-wp-api-extensions
- Files:
-
- 2 edited
-
tags/1.0/readme.txt (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wuxt-headless-wp-api-extensions/tags/1.0/readme.txt
r2091111 r2091159 14 14 == Description == 15 15 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. 16 This plugin adds a couple of extensions to the WordPress Rest API, which are aimed to make the use of WordPress as headless CMS easier. 17 It 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. 20 18 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** 22 32 23 33 * <code>GET</code> <code>/wp-json/wuxt/v1/front-page</code> 24 34 * <code>GET</code> <code>/wp-json/wuxt/v1/front-page?_embed</code> 25 35 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** 30 37 31 38 * <code>GET</code> <code>/wp-json/wuxt/v1/menu</code> 32 39 * <code>GET</code> <code>/wp-json/wuxt/v1/menu?location=<location></code> 33 40 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** 37 42 38 43 * <code>GET</code> <code>/wp-json/wuxt/v1/slug/<post-or-page-slug></code> 39 44 * <code>GET</code> <code>/wp-json/wuxt/v1/slug/<post-or-page-slug>?_embed</code> 40 45 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** 50 47 51 48 * <code>GET</code> <code>/wp-json/wp/v2/posts/?categories=1,2&and=true</code> 52 49 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** 57 51 58 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=<lat>,<lng>&distance=<distance></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><meta_key>:<coordinate></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=<lat>,<lng>&distance=<distance><km | m></code> 53 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=<lat_meta_field>:<lat>,<lng_meta_field>:<lng>&distance=<distance><km | m></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 73 57 74 58 == Installation == … … 102 86 = 1.0 = 103 87 * Version 1.0 done 88 -
wuxt-headless-wp-api-extensions/trunk/readme.txt
r2091109 r2091159 14 14 == Description == 15 15 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. 16 This plugin adds a couple of extensions to the WordPress Rest API, which are aimed to make the use of WordPress as headless CMS easier. 17 It 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. 20 18 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** 22 32 23 33 * <code>GET</code> <code>/wp-json/wuxt/v1/front-page</code> 24 34 * <code>GET</code> <code>/wp-json/wuxt/v1/front-page?_embed</code> 25 35 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** 30 37 31 38 * <code>GET</code> <code>/wp-json/wuxt/v1/menu</code> 32 39 * <code>GET</code> <code>/wp-json/wuxt/v1/menu?location=<location></code> 33 40 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** 37 42 38 43 * <code>GET</code> <code>/wp-json/wuxt/v1/slug/<post-or-page-slug></code> 39 44 * <code>GET</code> <code>/wp-json/wuxt/v1/slug/<post-or-page-slug>?_embed</code> 40 45 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** 50 47 51 48 * <code>GET</code> <code>/wp-json/wp/v2/posts/?categories=1,2&and=true</code> 52 49 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** 57 51 58 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=<lat>,<lng>&distance=<distance></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><meta_key>:<coordinate></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=<lat>,<lng>&distance=<distance><km | m></code> 53 * <code>GET</code> <code>/wp-json/wp/v2/posts/?coordinates=<lat_meta_field>:<lat>,<lng_meta_field>:<lng>&distance=<distance><km | m></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 73 57 74 58 == Installation == … … 102 86 = 1.0 = 103 87 * Version 1.0 done 88
Note: See TracChangeset
for help on using the changeset viewer.