lagdo / polr-api
A Restful API for the Polr URL Shortener.
Installs: 60
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 1
Open Issues: 0
Type:project
Requires
- laravel/lumen-framework: 5.1.*
Requires (Dev)
- fzaninotto/faker: ~1.0
- phpunit/phpunit: ^5.2
- symfony/css-selector: ^3.0
This package is auto-updated.
Last update: 2024-04-14 20:19:33 UTC
README
A Restful API for the Polr URL Shortener
Features
This package gives access to all Polr features through a Restful API, excepted the following.
- User creation and deletion.
- Password change.
- Link redirection.
Installation
Add the Polr API package to the composer.json
file of your Polr installation, and run composer update
.
{ "require": { "lagdo/polr-api": "~0.1" } }
Register the service provider in the bootstrap/app.php
.
$app->register(\Lagdo\Polr\Api\PolrApiServiceProvider::class);
Documentation
The API endpoints are documented here. The documentation is generated with API Doc.
Known issues
Sometimes the requests to the API return with errors due to CSRF verification failure. That's because Polr has disabled CSRF verification only for its own API endpoints.
This API endpoints then need to be also added in the app/Http/Middleware\VerifyCsrfToken.php
file.
public function handle($request, \Closure $next) { if ($request->is('api/v*') && !$request->is('api/v*/admin/*') && !$request->is('api/v*/link_avail_check')) { // Exclude public API from CSRF protection // but do not exclude private API endpoints return $next($request); } return parent::handle($request, $next); }