---
# System prepended metadata

title: photovoltaic-api

---

# photovoltaic-api

## Pendahuluan

### 1. Daftar isi

### 2. RES API
    > Base Url : http://<ip address>:<port>

#### 1. Auth Token

| Metode | Endpoint                    | Header | Body            | Deskripsi         |
| ------ | --------------------------- |:------:| --------------- | ----------------- |
| POST   | ```<Base Url>/user/login``` |   -    | email, password | mendapatkan token |

 > *Catatan: 
 > Token yang didapat hanya berlaku 1 jam.

##### Deskripsi Body

| Item | Type Data | Catatan |
| -------- | -------- | -------- |
| email     | String     | -     |
| password     | String     | -     |

#### 2. User

* pada user memuat informasi pengguna.

##### List API User



| Metode | Endpoin | Header | Query | Body | Deskripsi |
|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
|   POST   |   ```<Base Url>/user```   |   -   | - | idUser, name, email, password, role | membuat user baru |
|   GET   |   ```<Base Url>/user```   |   -   | name | - | mendapatkan User berdasarkan nama|
|   GET   |   ```<Base Url>/user```   |   -   | limit | - | mendapatkan semua User|
|   PATCH   |   ```<Base Url>/user```   |   token   | - | idUser, name, email, password | mengubah user |
|   DELETE   |   ```<Base Url>/user```   |   token   | - | idUser | menghapus User |

##### Deskripsi Body

| Item | Tipe Data | Deskripsi |
| -------- | -------- | -------- |
| idUser     | Number     | User Id |
| name     | String     | nama user yang dibuat |
| email     | String     |  |
| password     | String     |  |
| role     | String     | default user |
| limit     | Number | jumlah data yang diminta |

#### 2. Data

* Data sensor.

##### List API Data



| Metode | Endpoin | Header | Query | Body | Deskripsi |
|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
|   POST   |   ```<Base Url>/data```   |   token   | - | idUser, AC0, DC, AC1 |menambah data baru |
|   GET   |   ```<Base Url>/data```   |   -   | idUser, limit | - | mendapatkan Data berdasarkan id |
|   GET   |   ```<Base Url>/data```   |   -   | limit | - | mendapatkan seluruh data |
|   DELETE   |   ```<Base Url>/user```   |   token   | - | idUser | menghapus Data |

##### Deskripsi Body

| Item | Tipe Data | Deskripsi |
| -------- | -------- | -------- |
| idUser     | Number     | User Id |
| limit     | Number | jumlah data yang diminta |
| AC0     | Object | data tegangan AC inverter <E, Vrms, Irms, P, Q, S, PF>|
| DC     | Object | data tegangan DC <V, I, P, E> |
| AC1     | Object | data tegangan AC PLN/beban terpakai <E, Vrms, Irms, P, Q, S, PF>|

 > *Catatan: 
 > default nilai limit ketika tidak diisikan yaitu "10".

### 3. Laman Web

<!-- > link : http://202.148.1.57:2078 -->

* tampilan :

<img src="https://i.ibb.co/HtY0tv8/pvd.png" width="650">
<!-- ![image.png](https://i.ibb.co/HtY0tv8/pvd.png) -->
