---
# System prepended metadata

title: 運動紀錄

---

# 運動紀錄

# Schema

### 跑步紀錄

[ 跑步紀錄（SportRun）](Untitled%2011/SportRun.csv)

example:

```json=
    {
        "startTime ": "1584930045920",
    	"minute": 54,
    	"bpm": 60,
    	"distance": 100", 
    	"kcal":  100
    }
```

### 走路紀錄

[走路紀錄（SportWalk）](Untitled%2011/SportWalk.csv)

example:

```json=
    {
    	"dateTime": 1584930045920,
    	"minute": 54,
    	"bpm": 60,
    	"step": 100", 
    }
```
# API

## 運動目標

Request:

    POST /user/$uid/sport/goal

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Payload:

```json=
    {
       step: 12313131 (number)
    }
```

### 取得

Request:

    GET /user/$uid/sport/goal

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
    				"step":  8000
    		}
    }
```

## 跑步紀錄

### 新增

Request:

    POST /sport/run

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Payload:

```json=
    {
       SportRun
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
    						SportRun
    		}
    }
```

### 編輯

Request:

    PUT /sport/run/$id

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Payload:

```json=
    {
       SportRun
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
    						SportRun
    		}
    }
```

### 查詢列表

Request:

    GET /sport/run?$queryParams

[Query Params:](Untitled%2011/Query%20Params.csv)

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    	  "total": 5,
    		"data": [
    						SportRun,
    						SportRun,
             ...
    		]
    }
```

### 查詢單筆紀錄

Request:

    GET /sport/run/$id

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
            SportRun
        }
    }
```

### 刪除紀錄

Request:

    DELETE /sport/run/$id

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {}
    }
```

## 走路紀錄

### 新增

Request:

    POST /sport/walk

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Payload:

```json=
    {
       SportWalk
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
    						SportWalk
    		}
    }
```

### 編輯

Request:

    PUT /sport/walk/$id

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Payload:

```json=
    {
       SportWalk
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
    						SportWalk
    		}
    }
```

### 查詢列表

Request:

    GET /sport/walk?$queryParams

[Copy of Query Params:](Untitled%2011/Copy%20of%20Query%20Params.csv)

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    	  "total": 5,
    		"data": [
    						SportWalk,
    						SportWalk,
             ...
    		]
    }
```

### 查詢單筆紀錄

Request:

    GET /sport/walk/$id

Header:

```json=
    {
       "Authorization": "Bearer Owicare::<token>"
    }
```

Response (成功):

```json=
    {
    		"success": true,
    		"data": {
            SportWalk
        }
    }
```

### 刪除紀錄

Request:

    DELETE /sport/walk/$id

Header:

Response (成功):

```json=
    {
    		"success": true,
    		"data": {}
    }
```