|
| 1 | +## Using the Shlink sample bundle |
| 2 | + |
| 3 | +The Shlink example bundle in `samples/shlink-list-short-urls` demonstrates the ability to control a [Shlink](https://shlink.io/) server by getting the amount of short urls configured on the server. Here is a guide on how to get it working. |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | + |
| 7 | +- Working NodeCG & nodecg-io installation |
| 8 | +- [Shlink server and valid API key / token for it](https://shlink.io/documentation/install-docker-image/) |
| 9 | + |
| 10 | +### Configure the Shlink sample bundle |
| 11 | + |
| 12 | +1. Start nodecg with nodecg-io installed. The shlink-list-short-urls bundle is currently part of it so it should also be loaded. |
| 13 | + |
| 14 | +2. Go to the `nodecg-io` tab in the nodecg dashboard. |
| 15 | + |
| 16 | +3. Login using your password. If this is your first run, then enter the password with which you want to encrypt your configurations and credentials. |
| 17 | + |
| 18 | +4. Create a new Shlink service instance using the left upper menu. |
| 19 | + |
| 20 | +5. Enter the configuration for Shlink. |
| 21 | + |
| 22 | + The created instance should be automatically selected, if not, select it in the upper left menu. Enter the connection information for the Shlink server in monaco (the text-editor on the right) in this format: |
| 23 | + |
| 24 | + ```json |
| 25 | + { |
| 26 | + "url": "https://example.com", |
| 27 | + "apiKey": "1ae89449-f8d2-4b44-baf7-dd7eb0b05017" |
| 28 | + } |
| 29 | + ``` |
| 30 | + |
| 31 | + After entering it, click save. |
| 32 | + |
| 33 | + _Note:_ If you don't see monaco on the right, try reloading the page. |
| 34 | + |
| 35 | +6. Set the created Shlink service instance to the service dependency of the shlink-list-short-urls bundle. |
| 36 | + |
| 37 | + Select the shlink-list-short-urls bundle and the Shlink service in the left bottom menu and then select the service instance that should be used by the shlink-list-short-urls bundle (in this case the name of the previously created Shlink instance). |
| 38 | + |
| 39 | +7. Check the nodecg logs |
| 40 | + |
| 41 | + You should see an error or a success message and the amount of configured short urls on the Shlink server. |
| 42 | + |
| 43 | + _Note:_ When listing short urls - like this sample does - be aware that the amount of short urls might be limited by the [API key role](https://shlink.io/documentation/api-docs/api-key-roles/). |
0 commit comments