# Installation

## Installation methods

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!).

### Installation inside OXID (using oxid objects)

1\. Switch to your oxid `source` directory and install project

```
composer create-project oxid-community/oxid-rest-api --keep-vcs rest
```

2\. Add rewrite rules to `.htaccess` file after line\
\&#xNAN;*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 user

```
CREATE 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);
```

{% hint style="success" %}
Finished! Testing ... <http://localhost/rest/v1/object/articles?apiToken=t6PEqwkBpbdsf93osDSF913Bmcsd78pYWLtEgvs>
{% endhint %}

### Installation outside oxid (database only)

1\. Switch to your vhost ([example](https://github.com/OXIDprojects/oxid-rest-api/blob/master/docker/container/web/files/000-default.conf)) root directory and install project.&#x20;

```
composer create-project oxid-community/oxid-rest-api --keep-vcs rest
```

2\. Update database credentials in `.env` file

3\. Migrate and seed database

```
php artisan migrate
php artisan db:seed
```

{% hint style="success" %}
Finished! Testing ... <http://localhost/rest/v1/articles?apiToken=t6PEqwkBpbdsf93osDSF913Bmcsd78pYWLtEgvs>
{% endhint %}

## Update

Go to your rest directory and execute `git pull`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.oxid-projects.com/oxid-rest-api/getting-started/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
