用户协议
需求图谱 - 关联脑图API
通过关系矩阵分析,获取指定关键词的关联关系词
  • 接口状态:正常
  • 接入服务商: 5118.com
  • 使用人数:260060 人
  • 更新时间:2019-04-30
  • 应用类别: 需求图谱
低至: 0.009 元/次 ( 查询1次,计1次调用 )
  • API说明
  • 错误码参照
  • 价格与请求限制
  • 示例代码
详细说明:
  • 接口地址:http://apis.5118.com/naotu/related
  • 返回格式:json
  • 请求方式:POST

请求示例:http://apis.5118.com/naotu/related
提交任务调试工具: Postman示例
提交任务请求参数说明:
名称 类型 必填 默认值 说明
keyword string 关键词
提交任务返回参数说明:
名称 类型 默认值 说明
errcode string 0 返回的错误代码
errmsg string 返回的错误说明
name string 关联词(分父级与子级)
weight int 子级关联词出现次数
JSON返回示例:
{
    "errcode": "0",
    "errmsg": "",
    "data": [
        {
            "name": "账号",
            "words": [
                {
                    "name": "密码",
                    "weight": 4455
                },
                {
                    "name": "错误",
                    "weight": 1180
                }
            ]
        },
        {
            "name": "支付宝",
            "words": [
                {
                    "name": "账户",
                    "weight": 2991
                },
                {
                    "name": "账号",
                    "weight": 2156
                },
                {
                    "name": "银行卡",
                    "weight": 643
                },
                {
                    "name": "密码",
                    "weight": 628
                },
                {
                    "name": "认证",
                    "weight": 575
                }
            ]
        },...
}

提交充值订单
状态回调配置说明
服务级错误码参照(error_code):
错误码 说明
100101 调用次数不够,请充值
100102 服务每秒调用量超限
100103 服务每小时调用量超限
100104 服务每天调用量超限
100201 url无法解析
100202 请求缺少apikey
100203 无效的apikey
100204 api不存在
100205 api已经关闭
100206 服务商响应status非200
100207 服务商未正确接入
100208 请求方式不支持
100301 Api商城 内部错误
100302 请求服务商过程中错误
100303 系统繁忙稍候再试
100403 您输入的apikey不正确
系统级错误码参照:
错误码 说明
200104 数据分析中
200107 服务器超时
200201 传进参数为空
200202 用户ID为空
200409 输入非法字符
错误码格式说明:
2 002 01
服务器错误(1:为系统级别错误) 服务模块代码(即数据ID) 具体错误代码
资费说明:
名称 价格 次数 说明
首次试用套餐 0.00 100
套餐一 300.00 10000
套餐二 1800.00 100000
套餐三 9000.00 1000000
示例代码:
  1. <?php
  2. $curl = curl_init();
  3. curl_setopt_array($curl, array(
  4. CURLOPT_URL => 'http://apis.5118.com/naotu/related',
  5. CURLOPT_RETURNTRANSFER => true,
  6. CURLOPT_ENCODING => '',
  7. CURLOPT_MAXREDIRS => 10,
  8. CURLOPT_TIMEOUT => 0,
  9. CURLOPT_FOLLOWLOCATION => true,
  10. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  11. CURLOPT_CUSTOMREQUEST => 'POST',
  12. CURLOPT_POSTFIELDS => 'keyword=keyword',
  13. CURLOPT_HTTPHEADER => array(
  14. 'Authorization: 你要调用API的apikey,到 https://account.5118.com/signin/myapi 获取',
  15. 'Content-Type: application/x-www-form-urlencoded',
  16. ),
  17. ));
  18. $response = curl_exec($curl);
  19. curl_close($curl);
  20. echo $response;
  1. using System.Text;
  2. using System.Net;
  3. using System.Net.Security;
  4. using System.Security.Cryptography.X509Certificates;
  5. using Newtonsoft.Json;
  6. using System.Threading;
  7. public class ResultModel
  8. {
  9. public string errcode { get; set; }
  10. public string errmsg { get; set; }
  11. public string hashkey { get; set; }
  12. }
  13. private const String host = "http://apis.5118.com";
  14. private const String path = "/naotu/related";
  15. private const String method = "POST";
  16. private const String apikey = "你要调用的接口apikey";
  17. private void Form1_Load(object sender, EventArgs e)
  18. {
  19. String querys = "";
  20. String bodys = "keyword=keyword";
  21. String url = host + path;
  22. string str = SendPost(querys, bodys, url);
  23. Console.WriteLine(str);
  24. Console.WriteLine("\n");
  25. ResultModel model = JsonConvert.DeserializeObject<ResultModel>(str);
  26. while (true)
  27. {
  28. if (!string.IsNullOrEmpty(model.hashkey))
  29. {
  30. bodys = "hashkey=hashkey";
  31. string jsonStr = SendPost(querys, bodys, url);
  32. Console.WriteLine(jsonStr);
  33. break;
  34. }
  35. else
  36. {
  37. Thread.Sleep(60000);
  38. str = SendPost(querys, bodys, url);
  39. model = JsonConvert.DeserializeObject<ResultModel>(str);
  40. }
  41. }
  42. }
  43. private static string SendPost(string querys, string bodys, string url)
  44. {
  45. HttpWebRequest httpRequest = null;
  46. HttpWebResponse httpResponse = null;
  47. if (0 < querys.Length)
  48. {
  49. url = url + "?" + querys;
  50. }
  51. if (host.Contains("https://"))
  52. {
  53. ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
  54. httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
  55. }
  56. else
  57. {
  58. httpRequest = (HttpWebRequest)WebRequest.Create(url);
  59. }
  60. httpRequest.Method = method;
  61. httpRequest.Headers.Add("Authorization", apikey);
  62. //根据API的要求,定义相对应的Content-Type
  63. httpRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
  64. if (0 < bodys.Length)
  65. {
  66. byte[] data = Encoding.UTF8.GetBytes(bodys);
  67. using (Stream stream = httpRequest.GetRequestStream())
  68. {
  69. stream.Write(data, 0, data.Length);
  70. }
  71. }
  72. try
  73. {
  74. httpResponse = (HttpWebResponse)httpRequest.GetResponse();
  75. }
  76. catch (WebException ex)
  77. {
  78. httpResponse = (HttpWebResponse)ex.Response;
  79. }
  80. Console.WriteLine(httpResponse.StatusCode);
  81. Console.WriteLine(httpResponse.Method);
  82. Console.WriteLine(httpResponse.Headers);
  83. Stream st = httpResponse.GetResponseStream();
  84. StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
  85. return reader.ReadToEnd();
  86. }
  87. public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
  88. {
  89. return true;
  90. }
推荐API
百亿长尾词库,含指数和搜索量
获取域名(含子域名)PC端排名词

系统通知