POST api/msg/getmessage

获取消息《按发送时间倒序》

默认返回json数据,若要返回xml格式数据在访问地址后加上xml=true

Request 信息

URI 参数

None.

Body 参数

参数

MessagesModel
名称说明数据类型附加信息
CustId

客户id,选填

integer

None.

Cid

设备id

string

Required

IsOnlyUnread

是否只返回未读消息

boolean

None.

From

消息发送者

string

None.

BeforeId

消息开始Id(第一页无需传递)

integer

None.

IgnoreIds

忽略的消息Id

Collection of integer

None.

IsSetRead

是否将此会话的未读消息职位已读(请尽量第一次进入首次读取时设置为true,其他拉取置为false)

boolean

None.

Pi

PageIndex 页码,默认1

integer

None.

Ps

PageSize 页容量,默认20,最大50

integer

None.

City

城市

string

Required

Token

token

string

Required

Platform

string

None.

Request 数据格式

application/json, text/json

示例:
{
  "CustId": 1,
  "Cid": "sample string 1",
  "IsOnlyUnread": true,
  "From": "sample string 3",
  "BeforeId": 1,
  "IgnoreIds": [
    1,
    1
  ],
  "IsSetRead": true,
  "Pi": 1,
  "Ps": 1,
  "City": "sample string 5",
  "Token": "sample string 6",
  "Platform": "sample string 7"
}

application/xml, text/xml

示例:
<MessagesModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/API.Models.API.Msg">
  <Platform xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">sample string 7</Platform>
  <Token xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">sample string 6</Token>
  <City xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">sample string 5</City>
  <Pi xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">1</Pi>
  <Ps xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">1</Ps>
  <BeforeId>1</BeforeId>
  <Cid>sample string 1</Cid>
  <CustId>1</CustId>
  <From>sample string 3</From>
  <IgnoreIds xmlns:d2p1="http://schemas.datacontract.org/2004/07/System">
    <d2p1:long>1</d2p1:long>
    <d2p1:long>1</d2p1:long>
  </IgnoreIds>
  <IsOnlyUnread>true</IsOnlyUnread>
  <IsSetRead>true</IsSetRead>
</MessagesModel>

application/x-www-form-urlencoded

示例:

Response 信息

输出返回说明

结果

MessagesResult
名称说明数据类型附加信息
Messages

消息

Collection of Message

None.

SetReadCount

本次减少了多少条未读消息

integer

None.

ErrorCode

API错误码

APIErrorCode

None.

Msg

附带消息

string

None.

Response 返回数据格式

application/json, text/json

示例:
{
  "Messages": [
    {
      "Id": 1,
      "MsgId": 1,
      "PreviousId": 1,
      "MsgType": 1,
      "Content": "sample string 2",
      "Type": 0,
      "CreateTime": "2020-03-29T05:31:53.7370283+08:00",
      "Platform": "sample string 3"
    },
    {
      "Id": 1,
      "MsgId": 1,
      "PreviousId": 1,
      "MsgType": 1,
      "Content": "sample string 2",
      "Type": 0,
      "CreateTime": "2020-03-29T05:31:53.7370283+08:00",
      "Platform": "sample string 3"
    }
  ],
  "SetReadCount": 1,
  "ErrorCode": 0,
  "Msg": "sample string 2"
}

application/xml, text/xml

示例:
<MessagesResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/API.Models.API.Msg">
  <ErrorCode xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">SUCCESS</ErrorCode>
  <Msg xmlns="http://schemas.datacontract.org/2004/07/API.Models.API">sample string 2</Msg>
  <Messages>
    <MessagesResult.Message>
      <Content>sample string 2</Content>
      <CreateTime>2020-03-29T05:31:53.7370283+08:00</CreateTime>
      <Id>1</Id>
      <MsgId>1</MsgId>
      <MsgType>Text</MsgType>
      <Platform>sample string 3</Platform>
      <PreviousId>1</PreviousId>
      <Type>In</Type>
    </MessagesResult.Message>
    <MessagesResult.Message>
      <Content>sample string 2</Content>
      <CreateTime>2020-03-29T05:31:53.7370283+08:00</CreateTime>
      <Id>1</Id>
      <MsgId>1</MsgId>
      <MsgType>Text</MsgType>
      <Platform>sample string 3</Platform>
      <PreviousId>1</PreviousId>
      <Type>In</Type>
    </MessagesResult.Message>
  </Messages>
  <SetReadCount>1</SetReadCount>
</MessagesResult>