1.基本参数:
api_key:整合程序Key,Dnt中用于标识整合程序的唯一键,Dnt通过提取查询字符串的api_key参数,从配置文件api.config中查找并加载整合程序的配置信息(如密钥,回调Url等)
callback_url:登录成功后,重定向到的Url
auth_token:通过身份认证后,Dnt返回用于标识身份的令牌,将随callback_url一起返回
session_key:通过了身份认证后,整合程序用auth_token访问auth.getSession而获得
call_id:当前时间的日期和时间的计时周期数
format:数据响应格式,为XML或JSON
method:调用的方法,由“类名.方法名”格式表示
sig:对请求参数进行签名,主要用于防篡改
2.访问流程:(http://localhost:1856为论坛地址,http://localhost:8888/TestConsole.aspx为callback_url)
A.身份认证(登录):
客户端请求http://localhost:1856/login.aspx?api_key=4dd896caba8653c57b566477db3b697a
Dnt响应
如果登录成功,将创建auth_token,并重定向到
http://localhost:8888/TestConsole.aspx?auth_token=rI/MI2TVbuJF9osNbW0V81B48Rivbgvg3lFQ3GfF6lRcQmL8h5TizA==
B.身份请求
客户端请求
http://localhost:1856/services/restserver.aspx
表单参数(method,api_key,auth_token,sig),method为auth.getSession
Dnt响应
序列化的会话信息
C.API请求(以users.getLoggedInUser为例)
客户端请求
http://localhost:1856/services/restserver.aspx?sig=a56509460b9c2c329ef1065ecc387d8c&api_key=4dd896caba8653c57b566477db3b697a&call_id=634352654542491491&format=xml&method=users.getLoggedInUser&session_key=88bccbf3a47ae723f3d77e4aac26612b-2
Dnt响应
序列化的登录ID信息
D.退出
客户端请求
http://localhost:1856/logout.aspx?userkey=dc3949ba
Dnt响应
3.错误提示:
Dnt中用ErrorType枚举类型定义不同种类的错误,在ErrorDetails(继承自HashTable)中存储不同错误种类所对应的错误详细信息。在RESTServer中用ResponseErrorInfo方法输出,在其它调用层次中如果需要错误提示,只需返回相应的ErrorType就行了。
4.响应主体格式:XML或JSON