Maiduo HTTPAPI’s documentation!

/api/user/

POST /api/user/

注册新用户

新版API将会发送验证短信到用户手机,届时一个将会对同一手机的注册严格控制频率。

Form Parameters:
 
  • username – 手机号码
  • password – 密码
Status Codes:
  • 201 – 创建成功

/api/authentication/

POST /api/authentication/

用户认证,获取用户的token。

当存在device_token字段时,将登记设备用于接受消息推送。

响应:

HTTP/1.1 201 OK
Content-Type: application/json

{
    "access_token": "a80ba5617b6c4ec6acae2475a9cbdaee",
    "token_type": "bearer",
    "user": {
        "username": "test",
        "first_name": "",
        "id": 1
    },
    "refresh_token": "139881d1e4ad4fb18038287453f951a2"
}
Form Parameters:
 
  • username – 手机号码
  • password – 密码
  • device_token – [可选] iOS设备Token
Status Codes:
  • 201 – 创建成功

/aps/device/

POST /aps/device/

注册设备,在didRegisterForRemoteNotificationsWithDeviceToken中注册Token 如果Token更改或者第一次启动应用。

输出:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "pk": 1,
   "model": "ios_notifications.device",
   "fields": {
     "deactivated_at": null,
     "users": [],
     "service": 1,
     "platform": "",
     "last_notified_at": null,
     "is_active": true,
     "added_at": "2013-05-09T07:17:39Z",
     "os_version": "",
     "token": "a4faf00f4654246b9fd7e78ae29a49b321673892ae81721b8e74ad9d285b3c27",
     "display": ""
   }
 }
Form Parameters:
 
  • service – 服务的ID,通常是1。
  • token – iOS设备的Token。
Statuscode :

201

/aps/push/

POST /aps/push/

推送消息到iOS设备。

官方专用API,需要发送Base-Auth验证有权限的账号。

Form Parameters:
 
  • tokens – 设备Token - 逗号分隔多个Token,token1,token2。
  • message – 推送消息内容。
  • badge – 推送的badge数量。
  • sound – 推送的声音。
  • service – 服务的ID,通常是1。区别不同的推送服务,主要是在开发和生产环 境对推送的service是区别开的。
  • extra – 自定义的推送的内容,JSON格式。
  • persis – 持久化,数据库中保留该次推送。
  • no-persist – 不持久化,数据库不保留该次推送。
Status Codes:
  • 201 – 发送成功

/api/activity/

GET /api/activity/

拉取活动列表。

响应:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "id": 2,
    "subject": "The second activity."
    "owner": {
      "username": "test",
      "first_name": "",
      "id": 1
     },
    "user": [
      {
        "username": "test",
        "first_name": "",
        "id": 1
      }
    ],
  }
]
Query Parameters:
 
  • page – 分页
  • access_token – Access token
Status Codes:
  • 200 – 成功
POST /api/activity/

创建活动,当邀请的用户注册时自动成为活动的成员。

响应:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2,
  "subject": "The second activity."
  "owner": {
    "username": "test",
    "first_name": "",
    "id": 1
   },
  "user": [
    {
      "username": "test",
      "first_name": "",
      "id": 1
    }
  ],
}
Form Parameters:
 
  • subject – 活动标题

:form invitations:邀请朋友,格式是手机号码,半角逗号分割多个号码。 :form access_token: Access token :statuscode 200: 成功

/api/message/

GET /api/message/

获取最新的消息。

输出:

HTTP/1.1 200 OK
Content-Type: application/json

[
]
Query Parameters:
 
  • page – 分页,默认是0。
Status Codes:
  • 200 – no error
POST /api/message/

发送消息。

Form Parameters:
 
  • text – 消息的文本内容。
  • access_token – Access token
Status Codes:
  • 201 – 创建成功

/api/chats/

GET /api/chats/

获得聊天纪录。

输出:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "chat_id": 1001,
    "text": "Chat text 1001.",
    "created_at": "",
  },
  {
    "chat_id": 1002,
    "text": "Chat text 1002.",
    "created_at": "",
  }
]
Query Parameters:
 
  • page – 分页
  • access_token – Access token
Status Codes:
  • 200 – 成功

/api/chat/

GET /api/chat/

获得聊天内容,当聊天内容超过字数后,需要从这个资源里获得完整的内容。

输出:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 1,
    "text": "hello",
    "activity": {
        "id": 1,
        "subject": "Activity subject.",
        "owner": [
            {
                "id": 1,
                "first_name": "CJ"
            }
        ],
        "users": [
            {
                "id": 1,
                "first_name: "CJ"
            }
        ]
    },
    "created_at": ""
}
Query Parameters:
 
  • id – chat ID
  • access_token – Access token
Status Codes:
  • 200 – 成功
POST /api/chat/

发送聊天,成功以后会给该活动下所有成员发送聊天内容(除了发送者本人)。

Form Parameters:
 
  • activity_id – 活动ID
  • text – 聊天内容
  • access_token – Access token
Status Codes:
  • 201 – 创建成功

Release Notes

Indices and tables