感谢您的反馈!
TOP(Taobao Open Platform)接口是淘宝开放平台对外开放的 API 接口。
单个调用 TOP 接口
| 参数名 | 类型 | 是否可选 | 默认值 | 含义 |
|---|---|---|---|---|
options |
Object |
选项 | ||
options.query |
Object |
请求参数 | ||
options.query.method |
String |
TOP 接口名称 | ||
options.timeout |
Number Boolean |
可选 | false |
超时时间,单位:ms,为 false 时表示不考虑超时 |
options.success |
Function |
可选 | 调用成功的回调函数 | |
options.error |
Function |
可选 | 调用失败的回调函数 |
| 参数名 | 类型 | 是否必须返回 | 含义 |
|---|---|---|---|
result |
Object |
响应对象 | |
result.error_response |
Object |
可选 | 请求发生错误时的错误对象 |
QN.top.invoke({
query: {
method: 'taobao.user.seller.get', // TOP 接口名称
fields: 'nick,sex' // 除了`method`字段外,其他字段为请求的业务参数
}
}).then(result => {
console.log(result);
}, error => {
console.log(error);
});
QN.top.invoke({
query: {
method: 'taobao.user.seller.get', // TOP 接口名称
fields: 'nick,sex' // 除了`method`字段外,其他字段为请求的业务参数
},
success(result) {
console.log(result);
},
error(error) {
console.log(error);
},
});
批量调用 TOP 接口
| 参数名 | 类型 | 是否可选 | 默认值 | 含义 |
|---|---|---|---|---|
options |
Object |
选项 | ||
options.query |
Array |
请求参数数组 | ||
options.query[].topOptions |
Object |
请求参数 | ||
options.query[].topOptions.method |
String |
TOP 接口名称 | ||
options.success |
Function |
可选 | 调用成功的回调函数 | |
options.error |
Function |
可选 | 调用失败的回调函数 |
| 参数名 | 类型 | 是否必须返回 | 含义 |
|---|---|---|---|
result |
Array |
响应对象 | |
result[].error_response |
Object |
可选 | 请求发生错误时的错误对象 |
QN.top.batch({
query: [
{
method: 'taobao.user.seller.get', // TOP 接口名称
fields: 'nick,sex' // 除了`method`字段外,其他字段为请求的业务参数
}, {
method: 'taobao.time.get'
}
]
}).then(result => {
console.log(result[0]); // `taobao.user.seller.get` 的返回结果
console.log(result[1]); // `taobao.time.get` 的返回结果
}, error => {
console.log(error);
});
QN.top.batch({
query: [
{
method: 'taobao.user.seller.get', // TOP 接口名称
fields: 'nick,sex' // 除了`method`字段外,其他字段为请求的业务参数
}, {
method: 'taobao.time.get'
}
],
success(result) {
console.log(result[0]); // `taobao.user.seller.get` 的返回结果
console.log(result[1]); // `taobao.time.get` 的返回结果
},
error(error) {
console.log(error);
}
});