owned this note
owned this note
Published
Linked with GitHub
API List V2
==
### App
- 我的最愛
- 即時通知中心(GCM/APN)
- 圖示 icon 加入通知
- 推送登入資訊
- 推送來電顯示
- 聯絡人分類頁面
- 分類
- 通話紀錄
### Website
- 手機號碼登入 → 手機收驗證碼 → 登入成功
- email 備用登入,業務第一次登入要求認證 email
- 金流系統界接 - **這是就是前端的事了**
- 登入管理,業務自己的資料
- [x]顯示、修改基本資訊
- [x]下載 QRcode
- [ ]編輯與下載名片
## App 部分
#### :heart: 我的最愛
API Prefix **/api/v1/accounts/**
- [x]GET {user-uuid}/contacts?filter=like
- 取得喜愛聯絡人
- [x]PUT {contact-uuid}/contacts?like=true|false
- 修改:更改 contact like 欄位的 true, false
#### :tada: 自訂群組
API Prefix **/api/v1/accounts/**
- [x]GET `{user-uuid}/groups`
- 取得擁有的群組
- example of response
```javascript=
{
"groups":[
{
"groupName": "物聯網",
"groupId": "57062426d074d00537c4d14f",
"contactCount": 5
},
{
"groupName": "計算機網錄",
"groupId": "57062426d074d00537c4d14g",
"contactCount": 3
},
...
]
}
```
- [x]GET `{user-uuid}/groups/{groupId}/contacts`
- 取得群組內的通訊錄
- response
```javascript=
[
{
"id": "contact-id"
"userName": "詹姆士龐德",
"phoneNumber": "+886911234567",
"location": null,
"profile": "我寫程式碼",
"company": null,
"profilePhotoId": null,
"nickName": "老詹",
"chargeType": 1,
"availableStartTime": "0:19",
"availableEndTime": "15:20",
"isEnable": true,
"isHigherPriorityThanGlobal": false,
"providerAvailableStartTime": "00:00",
"providerAvailableEndTime": "00:00",
"providerIsEnable": true,
"qrCodeUuid": "c180f329-1825-43e2-9dd7-543facb0461a",
"customerIcon": null
},
...
]
```
- [x]POST `{user-uuid}/groups`
- 創立一個群組
- Payload
```javascript=
{
"groupName": "物聯網",
"contacts": ["contact-ids", "uiiuiuiuiu"]
}
```
- [x]DELETE `{user-uuid}/groups/{group-uuid}`
- 刪除該群組
- [x]PUT `{user-uuid}/groups/{group-uuid}/contacts
- url-param
```javascript=
?groupName=newName
```
- payload:
```javascript=
{"contacts": ["uuid", "adsasddas", ...]}
```
#### 通話紀錄
- [ ]GET /api/v1/accounts/{user-uuid}/history?before={timeStamp}
- 取得通話紀錄
- 參數
- before(非必要): 在該時間戳記或該時間戳記之前的通話紀錄(以開始通話時間為準)
- exmaple response
```javascript=
{
"record": [
{
"id": "20cb097a-e3b4-4c1b-8c4a-e47552cd8c87",
"startTime": -1,/**若沒接通則為-1,接通則為timestamp(毫秒)*/
"endTime": -1,/*若沒接通則為-1,接通則為timestamp(毫秒)*/
"answer": false,/*是否接通*/
"type": "outgoing|imcoming",
"durationMills": 0,/*通話毫秒數*/
"anotherUserId": "32edb1ed-dc5b-4e23-8eaf-8dd5b1abbe8c",
"anotherIsIcon": false,
"anotherIconId": null,
"anotherNickName": "總機",
"anotherName": "測試",
"anotherNum": "93050000",
"anotherAvatarId": null,
"contactId": "5705f5d665d27a0003c3bc95"/*可用該contactid撥電話給對方*/
}
]
}
```
- [ ]init dial
- [ ]call hangup handler -扣點
#### 即時通知中心 :santa:
取得歷史通知
- GET `/api/v2/accounts/{user-uuid}/notifications`
- 取得所有歷史通知
- response
```javascript=
{
"notifications": [
{
"createdAt": 1461080761326,
"contactId": "571652b9833124000365d179",
"id": "571652b9833124000365d17a",
"notificationContent": "小明 已經加入您為聯絡人"
}
]
}
```
使用 PubNub :+1:
API Prefix **/api/v1/notifications/**
- POST `login/{user-uuid}` with PubNub
- 使用者網站請求登入,選擇手機允許登入
- response
- statusCode 200 - 等待手機回覆
```javascript=
{
"randomChannel": "xercsxsbjk"
}
```
- POST `login/{user-uuid}/isAllow` with PubNub
- 使用者選擇允許或不允許
- Payload
```javascript=
{
"randomChannel": "xercsxsbjk"
}
```
## 網站部分
#### 登入
API Prefix **/api/v1/**
- POST `/accounts/{uuid}/validations`
- 無密碼登入,發送驗證碼
- Payload
```javascript=
{
"phoneNumber": "+886975533633"
"mode":"weblogin"
}
```
- Response
```javascript=
{
"userUuid":"854545"
}
```
- POST /accounts/tokens
- Payload
- 一次性密碼
```javascript=
{
"phoneNumber":"+88697654321"
"code":"243712",
"password":null
"mode":"disposablePass"
}
```
- 密碼登入
```javascript=
{
"phoneNumber":"+88697654321",
"code":"null",
"password":"voiceinisnotgood"
"mode":"password"
}
```
- POST `/acccouts/{uuid}/actions/changePassword`
- 修改: 新增修改密碼請求
```javascript=
{
"oldPassword": "",
"newPassword": "",
}
```
- POST `/payments`
- To create one payment,
- Token Required!! One token is correspond to ONE USER
```javascript=
{
"money":100,
"method":null,
"status":"pending",
"payId":"123123"
}
```
- POST `/payments/{payId}/actions/changePayment`
- To change one payment,
- If user's payment is successful, put "success" in "status" field to denote this status. User's points will be increase by the value specified in "money" field.
- Please Note: one payment can change status to "success" **ONLY ONE TIME**.
```javascript=
{
"status":"success"
}
```