Skip to content

Commit

Permalink
API visdata endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitskevich committed Dec 2, 2021
1 parent cbf7ddf commit 203fbd3
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ocp-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ All dates returned in responses are in UTC. Example: `2018-05-14T16:28:59.948845
- [Device Parameter API](./Device_Parameter_API.md)
- [`GET /params/read-realtime/` - Read current value of the parameter from the device](./Device_Parameter_API.md#RealtimeReadParams)
- [`POST /param/:paramId/write/` - Write parameter value to the device](./Device_Parameter_API.md#WriteParam)
- [Visualization API](./Visualization_API.md)
- [`GET /v1/vis/:visId/data/` - Get Visualization Data](./Visualization_API.md#GetVisualizationData)
- [`GET /v1/vis/:visId/data/save/` - Save Visualization Data](./Visualization_API.md#SaveVisualizationData)
84 changes: 84 additions & 0 deletions ocp-api/Visualization_API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<a name="top"></a>
# Overvis API v0.1.0 :: Visualization API

- [`GET /v1/vis/:visId/data/` - Get Visualization Data](#Get-Visualization-Data)
- [`GET /v1/vis/:visId/data/save/` - Save Visualization Data](#Save-Visualization-Data)

## <a name='Get-Visualization-Data'></a> `GET /v1/vis/:visId/data/` - Get Visualization Data
[Back to top](#top)

Returns the data that the user entered in the visualization. The answer is a "key: value" pair, where key is a string and value is a string.

```
GET /v1/vis/:visId/data/
```
*Required account permissions:* `demo`

### Parameters - `Param`
| Name | Type | Description |
|:---------|:-----------|:--------------------------------------|
| `visId` | `Number` | System ID of the visualization. |

### Examples

```bash
TOKEN=`curl -s -H "Content-Type: application/json" \
-d '{"apiKey": "513cf747-eb5c-4d5f-931f-d22c9872c73c", "password": "DCdcSLmkoZkU5zGI9gpInDbo" }' \
"https://ocp.overvis.com/api/v1/authenticate/" | \
jq -r ".token"` && \
curl -s -S -H "Content-Type: application/json" -H "Authorization: token $TOKEN" \
"https://ocp.overvis.com/api/v1/vis/7/data/" | \
jq -C
```

### Success response example

```json
{
"roomName": "Room 1",
"ownerName": "John"
}
```


## <a name='Save-Visualization-Data'></a> `GET /v1/vis/:visId/data/save/` - Save Visualization Data
[Back to top](#top)

Saves the data entered by the user in the visualization.

```
GET /v1/vis/:visId/data/save/
```
*Required account permissions:* `manager`

### Parameters - `Param`
| Name | Type | Description |
|:---------|:-----------|:--------------------------------------|
| `visId` | `Number` | System ID of the visualization. |

### Parameters - `Body`
| Name | Type | Description |
|:---------|:-----------|:--------------------------------------|
| `code` | `String` | Key for the value. |
| `value` | `String` | Value to be saved. |

### Examples

```bash
TOKEN=`curl -s -H "Content-Type: application/json" \
-d '{"apiKey": "513cf747-eb5c-4d5f-931f-d22c9872c73c", "password": "DCdcSLmkoZkU5zGI9gpInDbo" }' \
"https://ocp.overvis.com/api/v1/authenticate/" | \
jq -r ".token"` && \
curl -s -S -H "Content-Type: application/json" -H "Authorization: token $TOKEN" \
-d '{ "code": "roomName", "value": "Room 1" }' \
"https://ocp.overvis.com/api/v1/vis/7/data/save/" | \
jq -C
```

### Success response example

```json
{}
```


0 comments on commit 203fbd3

Please sign in to comment.