getive / api-server

消息盒子 - API服务

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Api-Server

消息盒子 - API

消息盒子提供的API是符合RESTful API设计原则的,此API用于消息盒子系统内部数据通讯。

此API搭建在内网localhost服务器上,端口为3399

测试链接

GET /api

{
  "message": "Welcome to MessageBox API"
}

消息发布

POST /api/:token/message/:userid/:typeid/:type/:author/:title/:content

字段 说明
token 访问权限验证
userid 用户id:如果是私有消息,此项必填作为接收者;如果是公共消息,可以为空。
typeid 消息类型id:1/2/3/4/5/6
type 消息种类 :public(公共)消息/private(私有)消息
author 发布者
title 消息标题
content 消息内容
  • 例子:http://localhost:3399/api/*****/message/000001/1/private/测试发布者/测试标题/测试内容

  • 返回结果:

{
  "message": "Message created.",
  "id": "36222aa0-377c-11e6-825c-e7dc08197a61"
}

id作用是获取当前发布消息的id,以便后续根据id进行查询

根据id查询消息

GET /api/:token/message/:id

{
  "id": "36222aa0-377c-11e6-825c-e7dc08197a61",
  "userid": "00000001",
  "typeid": 1,
  "type": "private",
  "title": "xxxxx",
  "author": "system",
  "desc": "xxxxxxx",
  "content": "xxxxxxx",
  "sendtime": "2016-06-21 09:40:37"
}

About

消息盒子 - API服务

License:MIT License


Languages

Language:JavaScript 100.0%