Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
robinscholz committed Aug 24, 2019
1 parent 0807d10 commit 67d3c32
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ Small [Kirby](https://getkirby.com) plugin that exposes the internal REST API at

## Usage

You can access the Better-Rest API route at `/rest`. The plugin only allows `GET` requests.
The API can be accessed at `/rest`. The plugin only allows `GET` requests.

### Authentification
Requests need to be authenticated via _Basic Auth_. It’s recommended to create a seperate _API User_ with a special blueprint at `site/blueprints/users/api.yml` or use the one provided by this plugin called [Better-Rest](https://github.com/robinscholz/better-rest/blob/master/blueprints/users/betterrest.yml). Read more about [User Roles in the docs](https://getkirby.com/docs/guide/users/roles).
Requests need to be authenticated via _Basic Auth_. It’s recommended to create a seperate _API User_ with either a custom blueprint or with the one provided by this plugin called [better-rest API](https://github.com/robinscholz/better-rest/blob/master/blueprints/users/betterrest.yml). Read more about [user roles in the docs](https://getkirby.com/docs/guide/users/roles).

### Kirby 3 API

Examples:

- `rest/pages/:id` : https://getkirby.com/docs/reference/api/pages
- `rest/site` : https://getkirby.com/docs/reference/api/site
- `rest/users/:id` : https://getkirby.com/docs/reference/api/users

> [official Kirby 3 API docs](https://getkirby.com/docs/reference/api/)
> [Official Kirby 3 API docs](https://getkirby.com/docs/reference/api/)
### Better-Rest Settings from Query

You can override the Settings defined in your Config file with each request in prefixing the param with `br-`.
All standard setting as well as settings defined in `site/config/onfig.php` can be overwritten on a per-request basis. Simply prefix the setting with `br-` and include it as a query.

Examples:

Expand All @@ -33,15 +34,15 @@ Examples:
- `rest/pages/test?br-kirbytags=0&br-srcset=0` : **br-kirbytag br-srcset**

### Multilang
The plugin supports multiple language settings. To fetch content for a specific language include a _X-Language header_ containing the desired language code with your request or use the Query.
The plugin supports multiple language settings. To fetch content for a specific language include a _X-Language header_ containing the desired language code with your request. Alternatively a `br-language` query can be used.

## Settings

### Config File

- The plugin converts _kirbytags_ to HTML and adds a `srcset` to images by default.
- You can enable smartytags to be applied.
- You can enforce a specific language in setting its language code.
- Additionally it is possible to enable [smartypants](https://michelf.ca/projects/php-smartypants/).
- To overwrite the default language it is possible to set a language code.

All settings need to be prefixed with `robinscholz.better-rest.`!

Expand All @@ -58,7 +59,7 @@ All settings need to be prefixed with `robinscholz.better-rest.`!
The Kirby installation needs to be served with a _TLS Certicificate_ via `https`.

### Local setup
For local development use [Laravel Valet](https://laravel.com/docs/master/valet) or disable `https` in your `site/config/config.php` like this:
For local development use [Laravel Valet](https://laravel.com/docs/master/valet) or disable `https` in the `site/config/config.php`:

``` php
return [
Expand All @@ -85,7 +86,7 @@ git submodule add https://github.com/robinscholz/better-rest.git site/plugins/be
```

## Credits
A big thanks to [@bnomei](https://github.com/bnomei) who refactored the initial source code into something extendable and future proof. If you are using this plugin please consider to [buy him ☕](https://buymeacoff.ee/bnomei)!
A big thanks to [@bnomei](https://github.com/bnomei) who refactored the initial source code into something extendable and future proof. If you are using this plugin please consider [buying him a](https://buymeacoff.ee/bnomei)!

## License
MIT

0 comments on commit 67d3c32

Please sign in to comment.