{"id":8093,"date":"2021-05-20T18:08:06","date_gmt":"2021-05-20T09:08:06","guid":{"rendered":"https:\/\/www.ecomottblog.com\/?p=8093"},"modified":"2021-05-20T18:27:35","modified_gmt":"2021-05-20T09:27:35","slug":"%e3%83%90%e3%83%aa%e3%83%a5%e3%83%bc%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%a7%e7%ae%a1%e7%90%86%e3%81%99%e3%82%8b%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e4%b8%80%e8%a6%a7%e3%82%92api%e3%81%a7","status":"publish","type":"post","link":"https:\/\/test.ecomottblog.com\/?p=8093","title":{"rendered":"\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u3067\u7ba1\u7406\u3059\u308b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092API\u3067\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<h6><a href=\"https:\/\/storyset.com\/web\" target=\"_blank\" rel=\"noopener\">Illustration by Freepik Storyset<\/a><\/h6>\n<h1>\u306f\u3058\u3081\u306b<\/h1>\n<p>\u5f53\u793e\u3067\u306f\u53e4\u304f\u304b\u3089GMO\u30c7\u30b8\u30ed\u30c3\u30af\u682a\u5f0f\u4f1a\u793e\u3055\u3093\u306e\u904b\u55b6\u3059\u308b\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3(https:\/\/www.value-domain.com\/)\u3067\u53d6\u5f97\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u304c\u305d\u3053\u305d\u3053\u306e\u6570\u3042\u308a\u3001\u306a\u304c\u3089\u304f\u5229\u7528\u3055\u305b\u3066\u9802\u3044\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u5b9f\u306f\u56f0\u308a\u3054\u3068\u3082\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h1>\u56f0\u308a\u3054\u3068<\/h1>\n<p>\u9577\u304f\u30c9\u30e1\u30a4\u30f3\u3092\u5229\u7528\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u305d\u308c\u306f\u3064\u307e\u308a\u30c9\u30e1\u30a4\u30f3\u3092\u5229\u7528\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3092\u9577\u304f\u904b\u7528\u3057\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308a\u3001\u5f53\u7136\u305d\u306e\u9593\u5225\u306e\u30b5\u30fc\u30d3\u30b9\u3092\u5897\u3084\u305b\u3070\u5897\u3084\u3059\u307b\u3069\u7ba1\u7406\u3059\u308b\u30c9\u30e1\u30a4\u30f3\u3082\u307e\u305f\u5f90\u3005\u306b\u5897\u3048\u3066\u304d\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5f53\u793e\u304c\u4f7f\u3063\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u306f\u904e\u53bb\u306e\u7d4c\u7def\u304b\u3089\u30b5\u30fc\u30d3\u30b9\u306e\u5185\u5bb9\u3084\u7528\u9014\u5225\u306b\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u8907\u6570\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u8cfc\u5165\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u305d\u308c\u305e\u308c\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001<\/p>\n<ol>\n<li>\u30a2\u30ab\u30a6\u30f3\u30c8A \u30ed\u30b0\u30a4\u30f3<\/li>\n<li>\u30a2\u30ab\u30a6\u30f3\u30c8A \u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u53d6\u5f97<\/li>\n<li>\u30a2\u30ab\u30a6\u30f3\u30c8A \u30ed\u30b0\u30a2\u30a6\u30c8<\/li>\n<li>\u30a2\u30ab\u30a6\u30f3\u30c8B \u30ed\u30b0\u30a4\u30f3<\/li>\n<li>\uff08\u4ee5\u4e0b\u7e70\u308a\u8fd4\u3057\uff09<\/li>\n<\/ol>\n<p>\u3068\u3001\u4f55\u5ea6\u3082\u30ed\u30b0\u30a4\u30f3\u3092\u7e70\u308a\u8fd4\u3055\u306a\u304f\u3066\u306f\u306a\u3089\u305a\u3001\u4eca\u5951\u7d04\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u306e\u7dcf\u500b\u6570\u3092\u78ba\u8a8d\u3059\u308b\u3068\u304b\u9762\u5012\u3067\u4ed5\u65b9\u304c\u306a\u3044\u306a\u3068\u601d\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3046\u3001\u3053\u308c\u307e\u3067\u306f\u3002<\/p>\n<h1>\u8ee2\u6a5f<\/h1>\n<p>\u305d\u306e\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u3067\u3059\u304c\u6628\u5e74API\u306e\u63d0\u4f9b\u304c\u884c\u308f\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u30c9\u30e1\u30a4\u30f3\u306e\u8cfc\u5165\u3084\u66f4\u65b0\u3001\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u5411\u3051\u306eAPI\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/www.value-domain.com\/info.php?action=press&amp;no=20200324-1\">VALUE-DOMAIN API\u516c\u958b\u306e\u304a\u77e5\u3089\u305b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.value-domain.com\/api\/doc\/domain\/\">\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 (1.0.0)<\/a><\/p>\n<\/li>\n<\/ul>\n<h1>\u4f55\u3092\u3059\u308b\u306e\u304b<\/h1>\n<p>\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u6570\u306f\u305f\u304b\u304c\u77e5\u308c\u3066\u3044\u307e\u3059\u304c\u6bce\u6708\u6bce\u65e5\u306e\u3088\u3046\u306b\u81ea\u793e\u304c\u5951\u7d04\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3059\u308b\u306e\u3067\u306f\u5730\u5473\u306b\u5927\u5909\u3067\u3059\u3002<\/p>\n<p>\u3053\u3053\u306f\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308bAPI <a href=\"https:\/\/www.value-domain.com\/api\/doc\/domain\/#operation\/getDomains\">\u30c9\u30e1\u30a4\u30f3\u306e\u60c5\u5831\u4e00\u89a7\u53d6\u5f97<\/a> \u3092\u5229\u7528\u3057\u3066\u30a2\u30ab\u30a6\u30f3\u30c8\u3054\u3068\u306b\u7ba1\u7406\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u624b\u9593\u3092\u524a\u6e1b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h1>\u4e8b\u524d\u6e96\u5099<\/h1>\n<h2>API-KEY\u306e\u767a\u884c<\/h2>\n<p>\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30d1\u30cd\u30eb\u30ed\u30b0\u30a4\u30f3\u5f8c\u3001\u4e0b\u56f3\u306e\u30e1\u30cb\u30e5\u30fc\u304b\u3089API-KEY\u3092\u767a\u884c\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30d1\u30cd\u30eb\u306e\u30e1\u30cb\u30e5\u30fc<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2021\/05\/clip-20201125193741.png\" alt=\"clip-20201125193741.png\" \/><\/p>\n<h3>\u767a\u884c\u3055\u308c\u305fAPI-KEY<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2021\/05\/2021-05-19-14-55-15.png\" alt=\"2021-05-19-14-55-15.png\" \/><\/p>\n<p>API-KEY\u3092\u767a\u884c\u3057\u305f\u3089KEY\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3>\u53c2\u8003:API-KEY\u306e\u4e00\u6642\u7684\u306a\u6709\u52b9\/\u7121\u52b9<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2021\/05\/clip-20201125193829.png\" alt=\"clip-20201125193829.png\" \/><br \/>\nAPI-KEY\u767a\u884c\u5f8c\u306fKEY\u306e\u6709\u52b9\/\u7121\u52b9\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4e0d\u8981\u306b\u306a\u3063\u305f\u3089\u5fd8\u308c\u305a\u306b\u7121\u52b9\u5316\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u53d6\u5f97\u3057\u305fAPI-KEY\u3092\u5143\u306bconfig\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<h3>\u4f5c\u6210\u4f8b\uff1avaluedomain.config<\/h3>\n<pre><code>[DEFAULT]\nvaluedomain.accounts = accountA, accountB, accountC\n\n[accountA]\napi-key = {API_KEY_1}\n\n[accountB]\napi-key = {API_KEY_2}\n\n[accountC]\napi-key = {API_KEY_3}\n<\/code><\/pre>\n<p>\u203b accountA~C\u306f\u5229\u7528\u3057\u3066\u3044\u308b\u30a2\u30ab\u30a6\u30f3\u30c8\u540d\u3092\u8a2d\u5b9a\u3059\u308b<br \/>\n\u203b{API_KEY_X}\u306e\u90e8\u5206\u306f\u53d6\u5f97\u3057\u305fAPI-KEY\u3092\u8a18\u5165\u3059\u308b<\/p>\n<h2>python\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<h3>\u4f5c\u6210\u4f8b\uff1avaluedomain.py<\/h3>\n<pre><code class=\"python\">import requests\nimport configparser\n\nconfig = configparser.ConfigParser()\nconfig.read('valuedomain.config')\ndomains = config['DEFAULT']['valuedomain.accounts'].replace(' ','').split(',')\n\nbase_url = 'https:\/\/api.value-domain.com\/v1\/'\naction_url = 'domains'\nrequest_param = '?limit=100' # 100\u4ef6\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u306f\u9069\u5207\u306b\u51e6\u7406\u3057\u3066\u304f\u3060\u3055\u3044\n\nresult_list = []\nfor domain in domains:\n    apikey  = config[domain]['api-key']\n    headers = {'Authorization': 'Bearer {}'.format(apikey)}\n    r_get   = requests.get(base_url + action_url + request_param, headers=headers)\n    json_data = r_get.json()\n\n    data = {\n        'domain':domain,\n        'result_format_type':'json',\n        'result':json_data['results']\n    }\n    result_list.append(data)\n\n# CSV\u51fa\u529b\u5f62\u5f0f\nprint(\"account,domainname,registrar,expirationdate,autorenew\")\nfor result_set in result_list:\n    vd_domain = result_set['domain']\n    for domain_data in result_set['result']:\n        pdata = [vd_domain, domain_data['domainname'], domain_data['registrar'], domain_data['expirationdate'], str(domain_data['autorenew'])]\n        print(','.join(pdata))\n<\/code><\/pre>\n<p>\u6e96\u5099\u306f\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u5b9f\u969b\u306b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<h1>\u5b9f\u884c\u3059\u308b<\/h1>\n<h3>\u4e00\u89a7\u53d6\u5f97\u306e\u4f8b<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2021\/05\/2021-05-20-14-41-57.png\" alt=\"2021-05-20-14-41-57.png\" \/><\/p>\n<p>\u8907\u6570\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u5229\u7528\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u306e\u4e00\u89a7\u304c\u53d6\u5f97\u3067\u304d\u3001\u624b\u9593\u304c\u5927\u5e45\u306b\u524a\u6e1b\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h1>\u611f\u60f3<\/h1>\n<p>\u6d77\u5916\u306e\u30ec\u30b8\u30b9\u30c8\u30e9\u306a\u3069\u3067\u306fAPI\u3092\u5229\u7528\u3067\u304d\u308b\u30b1\u30fc\u30b9\u304c\u591a\u3044\u306e\u306b\u5bfe\u3057\u56fd\u5185\u3060\u3068\u307e\u3060\u307e\u3060\u5c11\u306a\u3044\u5370\u8c61\u3067\u3057\u305f\u304c\u3001\u30c9\u30e1\u30a4\u30f3\u306e\u30ea\u30bb\u30e9\u30fc\u3067\u3042\u308b\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u3067API\u304c\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u306f\u500b\u4eba\u7684\u306b\u5b09\u3057\u3044\u5bfe\u5fdc\u3067\u3057\u305f\u3002<\/p>\n<p>\u5229\u7528\u3059\u308b\u4e0a\u3067\u306f<\/p>\n<ul>\n<li>\u5404\u30a2\u30ab\u30a6\u30f3\u30c8\u3054\u3068\u306bAPI-KEY\u304c\u4e00\u3064\u3057\u304b\u767a\u884c\u3067\u304d\u306a\u3044\uff08\u30ed\u30fc\u30ea\u30f3\u30b0\u66f4\u65b0\u304c\u3067\u304d\u306a\u3044\uff09<\/li>\n<li>\u66f4\u65b0\u7528\u3001\u53c2\u7167\u7528\u306a\u3069\u6a29\u9650\u306e\u7570\u306a\u308bKEY\u3092\u767a\u884c\u3067\u304d\u306a\u3044<\/li>\n<\/ul>\n<p>\u306a\u3069\u3001\u904b\u7528\u4e0a\u3067\u6c17\u3092\u3064\u3051\u308b\u3079\u304d\u70b9\u304c\u3042\u308a\u307e\u3059\u304c\u4eca\u5f8c\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306b\u671f\u5f85\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1>\u307e\u3068\u3081<\/h1>\n<ul>\n<li>\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u306b\u306fAPI\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u308b<\/li>\n<li>\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u53d6\u5f97\u306e\u52b9\u7387\u5316\u3092\u3057\u305f\u304b\u3063\u305f \u2192 \u3067\u304d\u305f<\/li>\n<li>\u8907\u6570\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u6240\u6301\u3057\u3066\u3044\u308b\u4eba\u306fAPI\u306e\u5229\u7528\u304c\u30aa\u30b9\u30b9\u30e1<\/li>\n<\/ul>\n<h1>\u4ed8\u9332<\/h1>\n<h3>Bash\u30b9\u30af\u30ea\u30d7\u30c8\u7248<\/h3>\n<pre><code>#!\/bin\/bash\n\naccount=(\"accountA\" \"accountB\" \"accountC\")\nkey=(\"{API_KEY_1}\" \"{API_KEY_2}\" \"{API_KEY_3}\")\n\necho \"account,domainname,registrar,expirationdate,autorenew\"\n\nfor ((i=0;i &lt; ${#account[@]}; i++)); do\n    API_KEY=${key[i]}\n    account=${account[i]}\n    curl --silent -H GET 'https:\/\/api.value-domain.com\/v1\/domains?limit=100' -H 'Content-Type:application\/json;charset=utf-8' -H \"Authorization: Bearer ${API_KEY}\" | jq -r --arg account $account '.results[] | [$account, .domainname, .registrar, .expirationdate, .autorenew] | @csv' | sed 's\/\"\/\/g'\ndone\n<\/code><\/pre>\n<p>\u203b accountA~C\u306f\u5229\u7528\u3057\u3066\u3044\u308b\u30a2\u30ab\u30a6\u30f3\u30c8\u540d\u3092\u8a2d\u5b9a\u3059\u308b<br \/>\n\u203b{API_KEY_X}\u306e\u90e8\u5206\u306f\u53d6\u5f97\u3057\u305fAPI-KEY\u3092\u8a18\u5165\u3059\u308b<\/p>\n<h3>\u516c\u5f0f\u30b5\u30a4\u30c8\u306b\u306fPHP\u7248\u306e\u4f7f\u7528\u4f8b\u3082\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/h3>\n<p><a href=\"https:\/\/www.value-domain.com\/service\/api\/\">\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3API<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8907\u6570\u3042\u308b\u30d0\u30ea\u30e5\u30fc\u30c9\u30e1\u30a4\u30f3\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3059\u308b\u306e\u304c\u5927\u5909\u306a\u306e\u3067API\u3067\u4e00\u5ea6\u306b\u53d6\u5f97\u3059\u308b\u8a71<\/p>\n","protected":false},"author":3,"featured_media":8123,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[50,107,108,35,11],"_links":{"self":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/8093"}],"collection":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8093"}],"version-history":[{"count":19,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/8093\/revisions"}],"predecessor-version":[{"id":8122,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/8093\/revisions\/8122"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/media\/8123"}],"wp:attachment":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}