README.md 2.48 KB
Newer Older
1 2
# ./play.it API

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
## Endpoints

### Games

#### Count

`/games/count`

Get count of supported games.

Example: http://api.dotslashplay.it/games/count

#### List

`/games/list`

Get list of supported games, including a screenshot thumbnail for each game.

Example: http://api.dotslashplay.it/games/list

#### Details

`/games/show/{id}`

Get details of game identified by numeric ID

Example: http://api.dotslashplay.it/games/show/57

`/games/collection/{game_id}`

Get details of games collection identified by game_id.

A game collection includes a base game and its DLCs.

Example: http://api.dotslashplay.it/games/collection/darkest-dungeon

`/games/search?search=$pattern`

Get list of games filtered by pattern

Example: http://api.dotslashplay.it/games/search?search=darkest%20dungeon

### Scripts

#### Count

`/scripts/count`

Get count of available scripts.

Example: http://api.dotslashplay.it/scripts/count

#### List

`/scripts/list`

Get list of available scripts.

Example: http://api.dotslashplay.it/scripts/list

#### Details

`/scripts/show/{id}`

Get details of script identified by numeric ID

Example: http://api.dotslashplay.it/scripts/show/58

### Archives

#### Count

`/archives/count`

Get count of supported archives.

Example: http://api.dotslashplay.it/archives/count

#### List

`/archives/list`

Get list of supported archives.

Example: http://api.dotslashplay.it/archives/list

#### Details

`/archives/show/{id}`

Get details of archive identified by numeric ID

Example: http://api.dotslashplay.it/archives/show/105

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
## Local installation instructions

1. Clone the repository locally

```
git clone https://framagit.org/vv221/play.it-api.git
cd play.it-api
```

2. Install PHP dependencies

```
composer install
```

3. Create and update the configuration file

```
cp .env.example .env
```

Edit the newly created .env, its contents should look like:

```
APP_NAME='./play.it API'
APP_ENV=development
APP_KEY=RYeT8bZlt4Cy4gpvNsepREgi+FJ1o5Gr
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_TIMEZONE=UTC

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_user
DB_PASSWORD=database_password

CACHE_DRIVER=file
QUEUE_CONNECTION=sync
```

To generate the app key you can use a command like `openssl rand -base64 24`

4. Create and populate the database

```
./artisan migrate:refresh --seed
```

5. Run a local instance

```
php -S localhost:8000 -t public
```

You can now access the API through http://localhost:8000/