QQ机器人开放式服务框架 Version 0.1 Draft - 显示服务列表

1. 服务查看请求

QQ机器人向服务供应商指定的URL端点发起HTTP GET请求,Sample Request如下:
无身份验证的HTTP GET / POST: http://fxservice.com/robot/list 有身份验证的HTTP GET / POST: http://fxservice.com/robot/list?&qq=124222313&type=group Request Header

Content-Type: application/x-www-form-urlencoded
Content-Length: length
Charset: UTF-8
 

对于来自私有服务频道的请求,服务供应者可根据请求的QQ号和QQ号类型(来自QQ个人用户或是QQ群)来判断该类型的QQ号是否有权限查看服务供应者提供的所有服务,并由此决定返回值。type可能的值有:

  • message (为QQ个人用户)
  • group_message(为QQ群用户)
  • discu_message(为QQ临时讨论组)

ts参数是否设置由实际应用中QQ机器人的逻辑需求来决定。如果请求中设置了时间戳参数,相应的reqTS也必须出现在响应中。reqTS的值取自于请求值。

2. 服务查看响应

服务供应商返回xml形式的响应。响应Schema如下:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >

<xs:simpleType name="nametype">
  <xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:simpleType name="versiontype">
  <xs:restriction base="xs:token"/>
</xs:simpleType>
<!-- Use <br/> explicitely as line separator in help tag -->
<xs:simpleType name="desctype">
  <xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="portaltype">
  <xs:restriction base="xs:anyURI"/>
</xs:simpleType>
<xs:simpleType name="authtype">
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:complexType name="servicetype">
  <xs:sequence>
    <xs:element name="name" type="nametype"/>
    <xs:element name="version" type="versiontype"/>    
    <xs:element name="desc" type="desctype"/>
    <xs:element name="portal" type="portaltype"/>
    <xs:element name="auth" type="authtype"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="serivceListtype">
    <xs:element name="service" maxOccurs="unbounded" type="servicetype"/>
    <xs:attribute name="serviceProviderName" type="nametype"/>
</xs:complexType>

<xs:element name="serivceList" type="serivceListtype"/>
</xs:schema> 

 

响应样例

服务供应商返回xml形式的响应。其Schema如下所示。如果某些服务为私有服务,并且所请求的QQ没有查看这些服务的权限,这些服务将不显示在服务列表中。

<?xml version="1.0"?>
<serivceList serviceProviderName="Mini Work Studio Pte. Lte.">
    <service>
        <name>fxservice</name>
        <version>1.0a<version>
        <desc><![CDATA[foreign exchange service]]></desc>
        <portal>http://fxservice.com/robot/portal.xml</portal>
        <auth>true</auth>
    <service>
    <service>
        <name>stock</name>
        <version>Beta<version>
        <desc>stock info service</desc>
        <portal>http://stock.com/robot/portal.xml</portal>
        <auth>false</auth>
    <service>    
</serivceList>

 

转载于:https://www.cnblogs.com/miniwork/archive/2013/01/01/2841009.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值