Installation
It´s possible to use this api only with the oxid database (without the framework and therefore without the oxid objects and oxid hooks. Also it´s possible to use this with bootstraped oxid framework (slow!).
1. Switch to your oxid
source
directory and install projectcomposer create-project oxid-community/oxid-rest-api --keep-vcs rest
2. Add rewrite rules to
.htaccess
file after line
RewriteRule oxseo.php$ oxseo.php?mod_rewrite_module_is=on [L]# LUMEN REST start
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
RewriteCond %{REQUEST_URI} .*rest.*
RewriteCond %{REQUEST_URI} !rest\.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* rest/public/index.php [L,QSA]
# LUMEN REST end
3. Create
rest_users
table and test userCREATE TABLE `rest_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`api-token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`api-rights` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'rw',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `rest_users` (`id`, `name`, `api-token`, `api-rights`, `created_at`, `updated_at`)
VALUES
(1,'Test User','t6PEqwkBpbdsf93osDSF913Bmcsd78pYWLtEgvs','rw',NULL,NULL);
Finished! Testing ... http://localhost/rest/v1/object/articles?apiToken=t6PEqwkBpbdsf93osDSF913Bmcsd78pYWLtEgvs
composer create-project oxid-community/oxid-rest-api --keep-vcs rest
2. Update database credentials in
.env
file3. Migrate and seed database
php artisan migrate
php artisan db:seed
Finished! Testing ... http://localhost/rest/v1/articles?apiToken=t6PEqwkBpbdsf93osDSF913Bmcsd78pYWLtEgvs
Go to your rest directory and execute
git pull
.Last modified 4yr ago