|
1 | | -# How to host Swagger API documentation with GitHub Pages |
2 | | -[<img alt="The blog of Peter Evans: How to Host Swagger Documentation With Github Pages" title="View blog post" src="https://peterevans.dev/img/blog-published-badge.svg">](https://peterevans.dev/posts/how-to-host-swagger-docs-with-github-pages/) |
| 1 | +# Agent DVR — REST API |
3 | 2 |
|
4 | | -This repository is a template for using the [Swagger UI](https://github.com/swagger-api/swagger-ui) to dynamically generate beautiful documentation for your API and host it for free with GitHub Pages. |
| 3 | +[Agent DVR](https://www.ispyconnect.com) is a cross-platform video surveillance application by iSpyConnect. It supports IP cameras, ONVIF devices, RTSP streams, USB cameras, and audio devices. Free for private local use; remote access, cloud storage, mobile apps, and business use require a subscription from $7.95/month. Runs on Windows 10+, macOS 11+, Linux (glibc 2.28+: Ubuntu 20.04+, Debian 10+, Fedora 29+, Arch), Docker, and Raspberry Pi 4+. Originally released as iSpy in 2007, rebuilt as Agent DVR in January 2022. 2M+ users worldwide. |
5 | 4 |
|
6 | | -The template will periodically auto-update the Swagger UI dependency and create a pull request. See the [GitHub Actions workflow here](.github/workflows/update-swagger.yml). |
| 5 | +**[Download Agent DVR](https://www.ispyconnect.com/download)** · [Features](https://www.ispyconnect.com/features) · [Documentation](https://www.ispyconnect.com/docs/agent/) · [Pricing](https://www.ispyconnect.com/buy) |
7 | 6 |
|
8 | | -The example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/). |
| 7 | +--- |
9 | 8 |
|
10 | | -## Steps to use this template |
| 9 | +This repository contains the REST API reference for Agent DVR. The API allows you to control Agent DVR programmatically — manage cameras and microphones, trigger recordings, arm and disarm, retrieve snapshots and video clips, subscribe to events, and integrate with third-party systems. |
11 | 10 |
|
12 | | -1. Click the `Use this template` button above to create a new repository from this template. |
| 11 | +**[→ View the full API reference](https://ispysoftware.github.io/Agent_API/)** |
13 | 12 |
|
14 | | -2. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages. |
| 13 | +## Base URL |
15 | 14 |
|
16 | | -  |
17 | | - |
18 | | -3. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`. |
| 15 | +By default Agent DVR runs at: |
| 16 | +``` |
| 17 | +http://localhost:8090 |
| 18 | +``` |
19 | 19 |
|
| 20 | +All API endpoints are relative to this base. When accessing Agent DVR remotely via the built-in relay, the base URL is provided in the web portal. |
20 | 21 |
|
21 | | -## Steps to manually configure in your own repository |
| 22 | +## Authentication |
22 | 23 |
|
23 | | -1. Download the latest stable release of the Swagger UI [here](https://github.com/swagger-api/swagger-ui/releases). |
| 24 | +API requests require a valid session token. Obtain one by posting credentials to `/account/login`. Pass the token in subsequent requests via the `session` query parameter or `Authorization` header. |
24 | 25 |
|
25 | | -2. Extract the contents and copy the "dist" directory to the root of your repository. |
| 26 | +## Key endpoints |
26 | 27 |
|
27 | | -3. Move the file "index.html" from the directory "dist" to the root of your repository. |
28 | | - ``` |
29 | | - mv dist/index.html . |
30 | | - ``` |
31 | | - |
32 | | -4. Copy the YAML specification file for your API to the root of your repository. |
| 28 | +| Endpoint | Description | |
| 29 | +|---|---| |
| 30 | +| `GET /command` | Send a command to a camera or microphone | |
| 31 | +| `GET /cameras` | List all cameras | |
| 32 | +| `GET /microphones` | List all microphones | |
| 33 | +| `GET /grab` | Get a snapshot from a camera | |
| 34 | +| `POST /account/login` | Authenticate and obtain a session token | |
33 | 35 |
|
34 | | -5. Edit [dist/swagger-initializer.js](dist/swagger-initializer.js) and change the `url` property to reference your local YAML file. |
35 | | - ```javascript |
36 | | - window.ui = SwaggerUIBundle({ |
37 | | - url: "swagger.yaml", |
38 | | - ... |
39 | | - ``` |
40 | | - Then fix any references to files in the "dist" directory. |
41 | | - ```html |
42 | | - ... |
43 | | - <link rel="stylesheet" type="text/css" href="dist/swagger-ui.css" > |
44 | | - <link rel="icon" type="image/png" href="dist/favicon-32x32.png" sizes="32x32" /> |
45 | | - <link rel="icon" type="image/png" href="dist/favicon-16x16.png" sizes="16x16" /> |
46 | | - ... |
47 | | - <script src="dist/swagger-ui-bundle.js"> </script> |
48 | | - <script src="dist/swagger-ui-standalone-preset.js"> </script> |
49 | | - ... |
50 | | - ``` |
51 | | - |
52 | | -6. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages. |
| 36 | +Full endpoint reference with parameters and response schemas: [ispysoftware.github.io/Agent_API](https://ispysoftware.github.io/Agent_API/) |
53 | 37 |
|
54 | | -  |
55 | | - |
56 | | -7. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`. |
| 38 | +## SDKs and integrations |
57 | 39 |
|
58 | | - The example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/). |
| 40 | +- **Home Assistant** — native integration, no API key required: [HACS Agent DVR integration](https://github.com/ispysoftware/agent-dvr-home-assistant) |
| 41 | +- **REST clients** — any HTTP client works; the API returns JSON |
| 42 | +- **MQTT** — Agent DVR can publish events to an MQTT broker for integration with home automation systems |
| 43 | + |
| 44 | +## Local development |
| 45 | + |
| 46 | +Agent DVR must be running locally or remotely to use the API. [Download Agent DVR](https://www.ispyconnect.com/download) to get started. |
0 commit comments