> For the complete documentation index, see [llms.txt](https://docs.vega365.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vega365.com/redundancy-management-framework/user-manual/rest-api.md).

# Rest API

Programmatic Access to Redundant Video Sources

## Overview

The RMF Web API provides an authenticated REST interface that allows third-party software, such as analytics tools, to access XProtect dual-recording redundancy information. Such information enables third-party software to retrieve video from redundant sources if the primary source fails.

{% embed url="<https://youtu.be/YUbU4pxi7TQ>" %}

## Where does it live?

The WebAPI is installed on the same system as the RMF Services and the Configuration UI. Installation locations vary based on the redundancy architecture, the number of cameras, and other parameters. By default, it is installed along with these components.&#x20;

For more detail, refer the page[What to Install Where](https://docs.vega365.com/redundancy-management-framework/user-manual/what-to-install-where.md).

## Configuration

Refer the link[Web API](https://docs.vega365.com/redundancy-management-framework/user-manual/workflows-dashboard/web-api.md)for the configuration of the API port number.

## Operation

{% stepper %}
{% step %}

### Normal Operation

The third-party component sources video from the primary recorder.

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2F9qEoe3NbDPpXOIQMiAjD%2Fimage.png?alt=media&amp;token=b2658e38-cffe-4dea-b2b9-0bcc8108ce86" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Failure Event

The primary recorder fails.

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2FSvurwlFvBEy37N3sqNLa%2Frec_fail.jpeg?alt=media&amp;token=e44e5b7c-d05a-4133-867c-66e3927204ec" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### API Query

The third-party component queries the RMF API.

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2F1pdOTV75cXjXpUPc3o4U%2Fquery.jpeg?alt=media&amp;token=e68a4d25-d3aa-4df5-82bf-81a73f7c032c" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Connect to the Redundant Source

Based on information provided by the API, the component connects to the redundant source and restores its functionality.

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2FaZNRJV4xenvF95aYN2rM%2Fredundant_source.jpeg?alt=media&amp;token=d55ce54a-7452-43b4-80be-e8ae016fc249" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## API

<details>

<summary>Fetch the Redundant Camera Map</summary>

### Query

#### XML

```
POST http://<management_server_IP>:<rmf_api_port_num>/VegaSystems/RMF/Mapping?type=xml
```

#### JSON

```
POST http://<management_server_IP>:<rmf_api_port_num>/VegaSystems/RMF/Mapping?type=json
```

Here:

\<management\_server\_IP> → IP address of the System that hosts the API\
\<rmf\_api\_port\_num> → RMF Port number. The default is 2020.

### Body

<pre><code>{
    "username": &#x3C;Xprotect credentials>, 
<strong>    "password": &#x3C;XProtect credentials>, 
</strong>    "search":[&#x3C;string1>,&#x3C;string2>,...]
}
</code></pre>

### Parameters

| Parameter | Info                                                                                                                                                                                                                                                                                                                                                           |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| username  | Must be an Active Directly user or a Windows user of Milestone XProtect. Do not use a basic user.                                                                                                                                                                                                                                                              |
| password  | The user's password                                                                                                                                                                                                                                                                                                                                            |
| search    | Omitting the search field causes the API to return the complete list of RMF managed cameras. However, if the search field is present, the API returns all cameras whose names partially or completely match any specified search strings. The API will return an empty list when the search strings do not match any camera names or portions of camera names. |

### Status Code

| HTTP Code        | appStatusCode               | Response Message                              |
| ---------------- | --------------------------- | --------------------------------------------- |
| 200              | NA                          | Login successful                              |
| 400              | Bad request ACCT\_AUTH\_001 | Username or password cannot be null or empty. |
| 401 Unauthorized | ACC\_AUTH\_022              | Login failed. Invalid credentials.            |
| 401 Unauthorized | ACC\_AUTH\_006              | Login failed. Invalid credentials.            |

### Example Response

#### XML Response

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2F8Rc4oYOllQs6VMnEJ7nL%2Fimage.png?alt=media&amp;token=133f9f74-4722-46aa-ada3-2b7243e27a01" alt=""><figcaption></figcaption></figure>

#### JSON Response

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2F7VuFw6bVtwO4sXewckLi%2Fimage.png?alt=media&amp;token=24f2ef40-b506-44bf-a490-f96ab06ee963" alt=""><figcaption></figcaption></figure>

</details>

## API Help Page

From a web browser, access the URL:

```
http://<management_server_IP>:<rmf_api_port_num>/VegaSystems/Help
```

to be directed to the RMF API help page as below.

<figure><img src="https://73860689-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK95oxUATgzuZZ2VhRoDw%2Fuploads%2FNb2kpCZnuvoSEstAF4ox%2Fimage.png?alt=media&amp;token=af80f60f-f631-4e17-8e42-60ae5b99d172" alt="" width="563"><figcaption></figcaption></figure>

## Demo Video

{% embed url="<https://youtu.be/iCHOZV0QF1Q>" %}
