阿里巴巴&阿里云出品

企业邮箱

用户指南

服务等级协议

API 参考

作者: 浏览量:132 更新时间: 2019.04.22

一、通用说明

API的调用格式形如:https://shujuapi.aliyun.com/dataplus_001/prophet/queryTopicsList?param1=ab&param2=cd

所有的返回结果中,都会附带以下系统级返回参数,用于判断接口调用是否出错及相应的出错信息。

系统级返回字段说明

参数名 参数类型 说明
success boolean 接口处理是否成功的标识
errorCode int 如果出错,表示出错状态码
other string 额外提示信息
msgCode int 提示信息状态码
msgInfo string 提示信息
messages array[string] 如果出错,表示出错信息。如果成功,也可能为成功的提示信息
result json 该对象封装了业务对象实体。如果success为true时,此对象才有值。 具体参数见各接口中说明

二、关键字专题接口

1、查询关键字专题

API功能:查询一个业务方的所有关键字专题列表,或者根据名称模糊匹配关键字专题列表。

接口名称:queryTopicsList

方法:GET

入参说明

参数名 参数类型 是否必填 说明
status int 状态。0:未启用 1:启用。 为null,表示查询所有关键字专题列表

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null,
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[{
  9. "id":6542,
  10. "name":"测试",
  11. "status":0,
  12. "createdAt":"2016-04-28T02:01:49.000Z",
  13. "updatedAt":"2016-04-28T02:12:13.000Z"
  14. }]
  15. }

返回参数说明

参数名 参数类型 说明
id int 关键字专题主键ID
name string 关键字专题名称
status int 关键字专题状态。0:未启用 1:启用
createdAt Date 创建时间。时间格式为UTC时间
updatedAt Date 更新时间。时间格式为UTC时间

2、创建关键字专题

API功能:用于创建一个新的关键字专题。

接口名称:createTopic

方法:POST

入参说明

参数名 参数类型 是否必填 说明
name string 关键字专题名称
status int 状态。0:未启用 1:启用 默认值:1

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null,
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":6543 //成功创建的关键字专题主键id
  9. }

3、更新关键字专题

API功能:对现有关键字专题的更新操作,可对关键字专题名称、是否开启监控状态这两个属性进行修改。

接口名称:updateTopic

方法:POST

参数:

入参说明

参数名 参数类型 是否必填 说明
id int 关键字专题主键ID
name string 关键字专题名称
status int 状态。0:未启用 1:启用

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null,
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":6543 //关键字专题主键id
  9. }

4、删除关键字专题

API功能:逻辑删除一个关键字专题。非物理删除,如果不小心物理删除,请提工单进行修正。

接口名称:deleteTopic

方法:POST

参数:

入参说明

参数名 参数类型 是否必填 说明
id int 关键字专题主键ID

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null,
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":6543 //成功删除的关键字专题主键id
  9. }

5、开启/关闭关键字专题

API功能:对现有关键字专题开启或者关闭

接口名称:turnTopic

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id int 关键字专题主键ID
status int 状态。0:未启用 1:启用

返回示例

{ “success”: true, “errorCode”: null, “other”: null, “msgCode”: null, “msgInfo”: null, “messages”: [ ], “errorMessages”: [ ], “result”: 6909 // 成功开启/关闭的关键字专题主键id }

三、源站类型

1、查询源站类型列表

API功能:该接口用于在添加关键字时,选择关联的源站类型。

请注意:源站类型的ID只用作添加/编辑关键字时使用,不可用于舆情查询接口。关键字创建后,关键字会关联到一个新的站点组ID(spiderTopicId)。此ID才可用于查询舆情时使用

接口名称:getSystemSiteTypes

方法:GET

入参说明

参数名 参数类型 是否必填 说明
name string 模糊匹配源
langType string 语言类型标识。默认为ch
  • 语言类型映射表:
标识 语言
fr 法语
es 西班牙语
de 德语
it 意大利语
pt 葡萄牙语
ru 俄语
jp 日语
ko 韩语
ar 阿拉伯语
nl 荷兰语
ch 中文
en 英语
vi 越南语
th 泰语
tr 土耳其语
he 希伯来语
id 印尼语
pl 波兰语
hi 印地语

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null,
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[
  9. {"id":8,"name":"新闻","langType":"ch"},
  10. {"id":9,"name":"微博","langType":"ch"},
  11. ....
  12. ]
  13. }

返回参数说明

参数名 参数类型 说明
id int 源站类型主键ID
name string 源站类型名称
langType string 源站类型语言

四、关键字接口

1、查询关键字

API功能:分页查询一个关键字专题下面的所有已经添加的关键字。

接口名称:getKeywords

方法:GET

入参说明

参数名 参数类型 是否必填 说明
topicId int 关键字专题ID
toPage int 用于分页查询。当前页码,默认值为:1
pageSize int 用于分页查询。每页显示条数。默认值为:20。

返回示例

  1. {
  2. "pageSize":20, // 每页显示多少
  3. "toPage":1, // 当前页码
  4. "totalCount":1, // 一共多少条
  5. "totalPages":1, // 一共多少页
  6. "success":true,
  7. "errorCode":null,
  8. "other":null,
  9. "msgCode":null,
  10. "msgInfo":null,
  11. "messages":[],
  12. "result":[{
  13. "id":12362, //关键字ID
  14. "keyword":"杭州 交通事故", //关键字内容
  15. "topicId":6544, //关键字专题ID
  16. "createdAt":"2016-04-28T03:09:12.000Z",
  17. "updatedAt":"2016-04-28T03:09:12.000Z",
  18. "spiderTopics":[{
  19. "id":2252, //站点组ID,用于舆情搜索时,指定的spiderTopicId
  20. "name":"新闻" //站点组名称
  21. },{
  22. "id":2253,
  23. "name":"微博"
  24. }]
  25. }]
  26. }

2、添加关键字

API功能:用于向一个关键字专题添加关键字。一个关键字组合内部可用空格表示“AND”的关系,可一次性添加多个关键字组合。

接口名称:createKeyword

方法:POST

入参说明

参数名 参数类型 是否必填 说明
topicId int 关键字专题ID
keywords string/array 关键字,多个关键字请用json数组封装,如 [“关键字1”,”关键字2”]
siteTypeIds int/array 关联的源站类型ID,多个请用json数组封装,如 [8,9]

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[12363,12364] // 创建成功的关键字ID数组
  9. }

3、删除关键字

API功能:逻辑删除关键字。删除后,系统将在约20分钟内生效;20分钟后,便不会再抓取该词,但是历史抓取记录会被保留。

接口名称:deleteKeyword

方法:POST

入参说明

参数名 参数类型 是否必填 说明
ids int/array 要删除的关键字ID。如果是多个,请用json数组封装,如 [12363,12364]

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[12363,12364] // 删除成功的关键字id数组
  9. }

4、编辑关键字(单个)

API功能:用于修改单个关键字的属性。支持对内容、所属关键字专题、抓取的源站类型3个属性的修改。

接口名称:updateKeyword

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id int 关键字主键ID
keyword string 关键字内容
topicId int 关键字专题ID
siteTypeIds int/array 关联的源站类型主键ID,多个请用json数组封装,如 [2232,2233]

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[12363] // 更新成功的关键字主键ID
  9. }

5、编辑关键字(批量)

API功能:用于修改多个关键字的属性。支持对所属关键字专题、抓取的源站类型两个属性的修改。

接口名称:updateKeywords

方法:POST

入参说明

参数名 参数类型 是否必填 说明
ids int/array 关键字主键ID,多个可用json数组封装,如 [12363,12364]
topicId int 关键字专题ID
siteTypeIds int/array 关联的源站类型主键ID,多个请用json数组封装,如 [2232,2233]

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[12369,12370] // 更新成功的关键字主键ID列表
  9. }

五、舆情数据

1、搜索舆情数据

API功能:用于对抓取数据的同步搜索。注意:该接口仅在数据抓取到后,才可搜索,而非实时从互联网中抓取,并且目前默认按发布时间排序。

接口名称:search

方法:GET

入参说明

参数名 参数类型 是否必填 说明
subject string 模糊匹配标题内容
description string 模糊匹配全文(标题+正文)
from string 源站名称,如:新浪网、百度贴吧、微博名
spiderTopicId int 站点组ID。请参考:getKeywords中返回的spiderTopics的ID属性
hotEvent string 热门事件名称。请参考:facetSearch中设置facetType=hot_event,返回的name属性
keyword string 关键词名称。请参考:facetSearch中设置facetType=keyword,返回的name属性
site string 媒体名称。请参考:facetSearch中设置facetType=site,返回的name属性
monitorTopicId int 关键字专题。请参考:getKeywords中返回的topicId属性
emotionTendencys int 情感趋势,1 正面,0 中性,-1 负面。
clusterId int 查询相似的舆情数据。一个cluster表示一批相似数据,同一批相似舆情的clusterId为同一个,clusterId为中心点舆情的主键。
createdAtBegin date 抓取开始时间(>=),格式 2016-04-28 13:30:41
createdAtEnd date 抓取结束时间(<=),格式 2016-04-28 13:30:41
pubTimeBegin date 舆情发布时间(>=),格式 2016-04-28 13:30:41
pubTimeEnd date 舆情结束时间(<=),格式 2016-04-28 13:30:41
clusterFlag int 合并相似:0:为合并相似状态,1:非合并状态,默认1
tab int 舆情列表类别:0:为全部舆情,1:有效舆情,2:新舆情
toPage int 用于分页查询。当前页码,不传默认值:1
pageSize int 用于分页查询。每页显示条数。默认值为:20。

返回示例

  1. {
  2. "pageSize":20,
  3. "toPage":20,
  4. "totalCount":0,
  5. "totalPages":0,
  6. "success":true,
  7. "errorCode":null,
  8. "other":null,
  9. "msgCode":null,
  10. "msgInfo":null,
  11. "messages":[],
  12. "result":{
  13. "records":[{
  14. "id":11175897,
  15. "monitorKeywords":"*",
  16. "monitorKeywordId":12359,
  17. "monitorTopicId":0,
  18. "subject":"《疯狂动物城》尼克狐的.....",
  19. "translateSubject":null,
  20. "translateDescription":null,
  21. "description":"*文章为作者独立观点,不代表虎嗅网立。。。。",
  22. "clusterId":11175897,
  23. "priority":4,
  24. "url":"http://www.huxiu.com/article/147005/1.html?f=index_feed_article",
  25. "createdAt":"2016-04-28T04:53:05.000Z",
  26. "pubTime":"2016-04-28T04:51:04.000Z",
  27. "from":"虎嗅网",
  28. "langType":"ch",
  29. "filterStatus":1,
  30. "wbType":2,
  31. "wbFansCount":0,
  32. "wbRepostCount":0,
  33. "wbCommentCount":0,
  34. "wbLikeCount":null,
  35. "wbVerifiedType":0,
  36. "emotionTendency":-1,
  37. "emotionScore":-7
  38. }],
  39. "facetFields":null,
  40. "dateFacetFields":null
  41. }
  42. }

返回参数说明

参数名 参数类型 说明
id int 舆情对象主键
productId int 先知的产品编号
spiderTopicId int 站点组ID:与源站类型是一一对应的。
monitorKeywordId int 舆情抓取的关键字ID
monitorKeywords string 舆情抓取的关键字内容
monitorTopicId int 关键字专题ID
from string 网站名/微博作者/微信公众号
url string 舆情链接。对应新闻URL/微博URL/微信公众号文章URL等
filterStatus int 0:待确认舆情,1:有效舆情 2:被过滤的舆情(放垃圾箱)
createdAt date 抓取时间
pubTime date 新闻/微博发布的时间(如果只获取到天,时分秒都为0)
wbId int 微博的主键ID
wbUserId int 微博用户的主键ID
wbFansCount int 微博粉丝数。可能在数据量大的情况下此值为空.
wbRepostCount int 微博转发数。原创微博抓取瞬间几乎都为0,如果为转发微博,建议开发者更新被转发微博的转发次数
wbCommentCount int 微博评论数。原创微博抓取瞬间几乎都为0,如果为转发微博,建议开发者更新被转发微博的评论次数
wbLikeCount int 微博点赞数。原创微博抓取瞬间几乎都为0,如果为转发微博,建议开发者更新被转发微博的点赞次数
wbVerifiedType int 微博用户认证类型 0-普通,1-个人认证,2-企业认证,3-微博达人。可能在数据量大的情况下此值为空。
wbType int 微博类型:0为原创微博,1为转发微博,2为微博评论
emotionTendency int 情感极性0中性 1正面 -1负面
emotionScore int 情感分数,绝对值越大,表示对应的情感越强烈
urlMD5 string url的md5哈希值
tags string 自动打上的标签,多个会用竖线进行分隔。
langType string 语言类型。如ch表示中文,en表示英文
subject string 文章标题。如果是微博,则为微博内容的摘要。
description string 正文摘要(100字以内)。如果是微博,则为微博内容的前100个字符
translateSubject string 如果是非中文和英文,翻译成英文之后的标题
translateDescription string 如果是非中文和英文,翻译成英文之后的详情
clusterId int 相似舆情的中心结点主键,在search接口传入此参数可查询与该条舆情相似的其他舆情数据
priority int 优先级,1到4表示P1到P4
similarCount int 相似数

2、将某舆情标示为有效

API功能:此接口将舆情标记为有效舆情,用于将用户操作的数据进行回流,以方便系统进行智能过滤。

接口名称:setIsValid

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id Long 舆情主键ID
flag int 有效状态。1:有效,0:无效(舆情在抓取时,默认就是无效,标记为0只用作取消错误标记为有效的舆情)

返回示例

  1. {
  2. "success":true,
  3. "errorCode":null
  4. "other":null,
  5. "msgCode":null,
  6. "msgInfo":null,
  7. "messages":[],
  8. "result":[11179498] // 更新成功的舆情主键ID
  9. }

3、热点事件、关键字、媒体、关键字专题展示

API功能:用于展示热点事件、关键字、媒体、关键字专题。注意:该接口拥有search接口的搜索过滤功能,可以通过填写搜索条件达到效果。

接口名称:facetSearch

方法:GET

入参说明

参数名 参数类型 是否必填 说明
subject string 模糊匹配标题内容
description string 模糊匹配全文(标题+正文)
from string 源站名称,如:新浪网、百度贴吧、微博名
spiderTopicId int 站点组ID。请参考:getKeywords中返回的spiderTopics的ID属性
hotEvent string 热门事件名称。请参考:facetSearch中设置facetType=hot_event,返回的name属性
keyword string 关键词名称。请参考:facetSearch中设置facetType=keyword,返回的name属性
site string 媒体名称。请参考:facetSearch中设置facetType=site,返回的name属性
monitorTopicId int 关键字专题ID。请参考:getKeywords中返回的topicId属性
emotionTendencys int 情感趋势,1 正面,0 中性,-1 负面。
clusterId int 查询相似的舆情数据。一个cluster表示一批相似数据,同一批相似舆情的clusterId为同一个,clusterId为中心点舆情的主键。
createdAtBegin date 抓取开始时间(>=),格式 2016-04-28 13:30:41
createdAtEnd date 抓取结束时间(<=),格式 2016-04-28 13:30:41
pubTimeBegin date 舆情发布时间(>=),格式 2016-04-28 13:30:41
pubTimeEnd date 舆情结束时间(<=),格式 2016-04-28 13:30:41
clusterFlag int 合并相似:0:为合并相似状态,1:非合并状态,默认1
tab int 舆情列表类别:0:为全部舆情,1:有效舆情,2:新舆情
facetType string 分组展示类型:hot_event:热门事件,keyword:关键字,site:媒体,monitor_topic:关键字专题
toPage int 用于分页查询。当前页码,不传默认值:1
pageSize int 用于分页查询。每页显示条数。默认值为:20。

返回示例

  1. {
  2. "success": true,
  3. "data": [
  4. {
  5. "name": "微信", //注意,facetType=monitor_topic,返回的name为关键字专题ID
  6. "count": 453
  7. },
  8. {
  9. "name": "和讯网",
  10. "count": 95
  11. }
  12. ]
  13. }

返回参数说明

参数名 参数类型 说明
success boolean 本次请求是否有效:true有效,false失败
name string 名称,如分组展示类型hot_event:热门事件名称,keyword:关键字名称,site:站点名称,monitor_topic:关键字专题名ID
count int 舆情数量,如分组展示类型hot_event:热门事件下舆情数量,keyword:关键字下舆情数量,site:站点下舆情数量,monitor_topic:关键字专题下舆情数量

4、变更某舆情情感

API功能:此接口可以变更舆情情感,用于人工校验情感。

接口名称:setEmotion

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id Long 舆情主键ID
emotionTendency int 情感趋势。1:正面,0:中性,-1:负面

返回示例

  1. {
  2. "success": true,
  3. "errorCode": null,
  4. "other": null,
  5. "msgCode": null,
  6. "msgInfo": null,
  7. "messages": [],
  8. "errorMessages": [],
  9. "result": 13420071 // 更新成功的舆情主键ID

}

5、修改某舆情的风险等级

API功能:此接口将修改舆情的风险等级。

接口名称:setRisk

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id Long 舆情主键ID
riskType int 风险等级。1:P1等级,2:P2等级,3:P3等级,4:P4等级

返回示例

  1. {
  2. "success": true,
  3. "errorCode": null,
  4. "other": null,
  5. "msgCode": null,
  6. "msgInfo": null,
  7. "messages": [],
  8. "errorMessages": [],
  9. "result": 13420071 // 更新成功的舆情主键ID

}

6、将某舆情放入回收站

API功能:此接口用于过滤指定舆情数据,放入回收站。

接口名称:setDustbin

方法:POST

入参说明

参数名 参数类型 是否必填 说明
id Long 舆情主键ID

返回示例

  1. {
  2. "success": true,
  3. "errorCode": null,
  4. "other": null,
  5. "msgCode": null,
  6. "msgInfo": null,
  7. "messages": [],
  8. "errorMessages": [],
  9. "result": 13420071 // 更新成功的舆情主键ID

}

7、查询舆情详情数据

API功能:用于查询舆情详情数据

接口名称:getDetail

方法:GET

入参说明

参数名 参数类型 是否必填 说明
id Long 舆情Id

返回示例

  1. {
  2. "success": true,
  3. "errorCode": null,
  4. "other": null,
  5. "msgCode": null,
  6. "msgInfo": null,
  7. "messages": [],
  8. "errorMessages": [],
  9. "messageContext": {},
  10. "result": {
  11. "id": 13679723,
  12. "productId": 13966,
  13. "spiderTopicId": 1340,
  14. "monitorKeywords": "11"

5折钜惠,豪礼相送:尊享1V1专员服务、赠送“对接钉钉”服务、赠送英文.cn/.com顶级域名

填写资料马上体验阿里企业邮箱

工作时间5-10分钟将由1对1顾问为您提供尊享服务

  • *公   司

    公司名称不能为空

  • *帐号数

    帐号数不能为空或输入有误

  • *电   话

    电话不能为空或输入有误

  • 联系人
  • 域名