使用Node JS获取有效的聊天频道列表
使用Node JS获取有效的聊天频道列表
Node JS : API文档
使用Node JS获取有效的聊天频道列表
var aclass = "chat";
var method = "getchatchannels";
var user = "user";
var password = "password";
const https = require('https')
const options = {
hostname: 'afilnet.com',
port: 443,
path: '/api/http/?class='+aclass+'&method='+method+'&user='+user+'&password='+password,
method: 'GET'
}
const req = https.request(options, res => {
res.on('data', d => {
// Do something
})
})
req.on('error', error => {
console.error(error)
})
req.end()
var aclass = "chat";
var method = "getchatchannels";
var user = "user";
var password = "password";
const https = require('https')
const options = {
hostname: 'afilnet.com',
port: 443,
path: '/api/http/?class='+aclass+'&method='+method+'&user='+user+'&password='+password,
method: 'POST'
}
const req = https.request(options, res => {
res.on('data', d => {
// Do something
})
})
req.on('error', error => {
console.error(error)
})
req.end()
参数 | 描述 | 必修/可选 |
---|---|---|
class=chat | 要求的课程:要求的课程 | 必修 |
method=getchatchannels | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
-
list
- platformid
- platform
- name
-
list
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
参数:
- class : chat
- method : getchatchannels
- user : user
- password : password
请求:
https://www.afilnet.com/api/http/?class=chat&method=getchatchannels&user=user&password=password