{"id":103,"date":"2017-04-24T10:08:07","date_gmt":"2017-04-24T01:08:07","guid":{"rendered":"https:\/\/www.ecomott.co.jp\/tech_blog\/?p=103"},"modified":"2018-09-13T10:22:50","modified_gmt":"2018-09-13T01:22:50","slug":"fastio-api%e3%81%ae%e7%b4%b9%e4%bb%8b%e2%91%a0-%ef%bd%9e-%e3%83%ad%e3%82%b0%e3%83%87%e3%83%bc%e3%82%bf%e8%a8%88%e6%b8%ac%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3api","status":"publish","type":"post","link":"https:\/\/test.ecomottblog.com\/?p=103","title":{"rendered":"FASTIO API\u306e\u7d39\u4ecb\u2460 \uff5e \u30ed\u30b0\u30c7\u30fc\u30bf\u8a08\u6e2c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3API \uff5e"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01<br \/>\n\u958b\u767a\u90e8\u306e\u6b66\u5185\u3067\u3059\u3002<\/p>\n<p>\u672c\u30a8\u30f3\u30c8\u30ea\u3067\u306f<strong>FASTIO API<\/strong>\u306e\u7d39\u4ecb\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>FASTIO API\u3068\u306f<\/h2>\n<p>FASTIO\u3067\u7ba1\u7406\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3084\u5236\u5fa1\u4fe1\u53f7\u3092\u5916\u90e8\u304b\u3089\u5229\u7528\u3059\u308b\u305f\u3081\u306eAPI\u3067\u3001<br \/>\nWeb API\uff08HTTP\u3092\u7528\u3044\u305f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\uff09\u3068\u3057\u3066\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u901a\u5e38\u306fFASTIO\u30b5\u30a4\u30c8\u4e0a\u3067\u78ba\u8a8d\u30fb\u64cd\u4f5c\u3044\u305f\u3060\u3044\u3066\u3044\u308b\u3053\u3068\u3092<br \/>\n\u5916\u90e8\u304b\u3089\u53ef\u80fd\u306b\u3059\u308b\u4ed5\u7d44\u307f\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3069\u306e\u3088\u3046\u306aAPI\u69cb\u6210\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u306f<br \/>\n\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/www.fastio.jp\/fastio-api\/\">FASTIO API\u7d39\u4ecb\u30da\u30fc\u30b8<\/a><\/p>\n<h2>\u8a08\u6e2c\u30c7\u30fc\u30bf\u53d6\u5f97API\u3067\u4f1a\u8b70\u5ba4\u306e\u3069\u3093\u3088\u308a\u5177\u5408\u3092\u53ef\u8996\u5316<\/h2>\n<p>\u4f1a\u8b70\u5ba4\u306b\u3053\u3082\u308a\u8b70\u8ad6\u3092\u4ea4\u308f\u3057\u3066\u3044\u308b\u3068\u3001\u3060\u3093\u3060\u3093\u7a7a\u6c17\u4e2d\u306eCO2\u6fc3\u5ea6\u304c\u9ad8\u307e\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\nCO2\u6fc3\u5ea6\u306fppm\u3068\u3044\u3046\u5358\u4f4d\u3067\u8868\u3057\u307e\u3059\u304c\u3001<br \/>\n2500ppm\u3092\u8d85\u3048\u308b\u3068\u6025\u6fc0\u306b\u601d\u8003\u529b\u3084\u96c6\u4e2d\u529b\u304c\u4f4e\u4e0b\u3059\u308b\u3068\u3044\u3046\u7814\u7a76\u30c7\u30fc\u30bf\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n\u9577\u3044\u4f1a\u8b70\u3067\u7720\u304f\u306a\u308b\u306e\u3082\u3053\u308c\u304c\u539f\u56e0\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u305f\u3060\u8b70\u8ad6\u4e2d\u306b\u300c\u63db\u6c17\u3057\u3088\u3046\u300d\u300c\u4f11\u61a9\u3057\u3088\u3046\u300d\u3068\u8a00\u3044\u51fa\u3057\u306b\u304f\u3044\u3053\u3068\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4f1a\u8b70\u306b\u53c2\u52a0\u3057\u3066\u3044\u308b\u4eba\u305d\u308c\u305e\u308c\u304cCO2\u6fc3\u5ea6\u3092\u610f\u8b58\u3067\u304d\u308b\u3088\u3046\u306b\u3001<br \/>\n\u8a08\u6e2c\u30c7\u30fc\u30bf\u53d6\u5f97API\u3092\u4f7f\u3063\u3066CO2\u6fc3\u5ea6\u8868\u793a\u30b7\u30b9\u30c6\u30e0\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u203b\u4eca\u56de\u306fPHP\u3067\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u304c\u3001Web API\u306a\u306e\u3067\u3069\u306e\u8a00\u8a9e\u304b\u3089\u3067\u3082\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002<\/strong><\/p>\n<h4>\u30b7\u30b9\u30c6\u30e0\u69cb\u6210<\/h4>\n<p>\u4f1a\u8b70\u5ba4\u306b\u306f <a href=\"https:\/\/www.ecomott.co.jp\/product\/wmc-600.html\">WMC-600<\/a> \u3092\u914d\u7f6e\u3057\u3001\u63a5\u7d9a\u3057\u305fCO2\u30bb\u30f3\u30b5\u304cCO2\u6fc3\u5ea6\u3092\u8a08\u6e2c\u3057\u307e\u3059\u3002<br \/>\n\u8a08\u6e2c\u30c7\u30fc\u30bf\u306fFASTIO\u306b\u84c4\u7a4d\u3055\u308c\u308b\u306e\u3067\u3001\u5916\u90e8\u306eWeb\u30b5\u30fc\u30d0\u306fFASTIO API\u3092\u4f7f\u3044\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\nWeb\u30b5\u30fc\u30d0\u306bCO2\u6fc3\u5ea6\u8868\u793a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u914d\u7f6e\u3057\u3001\u305d\u308c\u3092\u30bf\u30d6\u30ec\u30c3\u30c8\u306e\u30d6\u30e9\u30a6\u30b6\u3067\u898b\u308b\u3001\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2017\/04\/system.png\" alt=\"system\" \/><\/p>\n<h4>\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97<\/h4>\n<p>\u5404API\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"php\">\/\/ JSON\u3092POST\u3059\u308b\u95a2\u6570\nfunction postJson($url, $data) {\n    $ch = curl_init();\n    curl_setopt($ch, CURLOPT_URL, $url);\n    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application\/json'));\n    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($ch, CURLOPT_POST, true);\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    $result = curl_exec($ch);\n    curl_close($ch);\n    return $result;\n}\n\n\/\/ \u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\n$data = array(\n    'username' =&gt; 'FastioUser',     \/\/ FASTIO\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30e6\u30fc\u30b6\u540d\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n    'password' =&gt; 'FastioPassword', \/\/ FASTIO\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n    'grant_type' =&gt; 'password',\n    'scope' =&gt; 'api',\n    'client_id' =&gt; 'FastioClientID' \/\/ FASTIO\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8ID\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n);\n$data = json_encode($data); \/\/ POST\u30c7\u30fc\u30bf\u3092JSON\u30a8\u30f3\u30b3\u30fc\u30c9\n$result = postJson('https:\/\/hogepiyo.fastio.jp\/oauth2\/token', $data);   \/\/ POST\u3057\u3066\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\n$result = json_decode($result, true);   \/\/ \u30ec\u30b9\u30dd\u30f3\u30b9\u3092JSON\u30c7\u30b3\u30fc\u30c9\n$token = $result['access_token'];   \/\/ \u30c8\u30fc\u30af\u30f3\u3092\u53d6\u308a\u51fa\u3059\n\n\/\/ hogepiyo.fastio.jp \u306f\u5f0a\u793e\u63d0\u4f9b\u306eAPI\u4ed5\u69d8\u66f8\u306b\u6b63\u5f0f\u306aURL\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n<\/code><\/pre>\n<h4>\u30c7\u30fc\u30bf\u306e\u53d6\u5f97<\/h4>\n<p>\u8a08\u6e2c\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"php\">\/\/ \u8a08\u6e2c\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\n$data = array(\n    'access_token' =&gt; $token,\n    'term_id' =&gt; 'TermID',                              \/\/ CO2\u30bb\u30f3\u30b5\u306e\u7aef\u672bID\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n    'no' =&gt; 'TermNo',                                   \/\/ CO2\u30bb\u30f3\u30b5\u306e\u7aef\u672bNO\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n    'from' =&gt; date('YmdHis', strtotime(\"- 1 hour\")),    \/\/ \u3053\u3053\u3067\u306f1\u6642\u9593\u524d\u304b\u3089\n    'to' =&gt; date('YmdHis')                              \/\/ \u73fe\u5728\u307e\u3067\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\n);\n$data = json_encode($data); \/\/ POST\u30c7\u30fc\u30bf\u3092JSON\u30a8\u30f3\u30b3\u30fc\u30c9\n$result = postJson('https:\/\/hogepiyo.fastio.jp\/logger\/data\/regular', $data);    \/\/ POST\u3057\u3066\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\n$result = json_decode($result, true);   \/\/ \u30ec\u30b9\u30dd\u30f3\u30b9\u3092JSON\u30c7\u30b3\u30fc\u30c9\n\n\/\/ hogepiyo.fastio.jp \u306f\u5f0a\u793e\u63d0\u4f9b\u306eAPI\u4ed5\u69d8\u66f8\u306b\u6b63\u5f0f\u306aURL\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n<\/code><\/pre>\n<h4>\u53d6\u5f97\u3055\u308c\u305f\u30c7\u30fc\u30bf<\/h4>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"json\">{\n    \"attributes\": [{    \u2190 \u8a08\u6e2c\u30c7\u30fc\u30bf\u9805\u76ee\u306e\u60c5\u5831\n        \"no\": 0,\n        \"name\": \"CO2\u30bb\u30f3\u30b5\",\n        \"unit\": \"ppm\"\n    }],\n    \"data\" :{           \u2190 \u8a08\u6e2c\u30c7\u30fc\u30bf\n        \"0\": [[\n            1438268460, \u2190 \u8a08\u6e2c\u6642\u523b\uff08UNIX TIME\uff09\n            1500        \u2190 \u8a08\u6e2c\u5024\n        ], [\n            1438268400,\n            1000\n        ]]\n    }\n}\n<\/code><\/pre>\n<h4>Web\u753b\u9762\u306b\u8868\u793a\u3059\u308b<\/h4>\n<p>\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"php\">echo $result[data][0][0][1];    \/\/ \u6700\u65b0\u5024\u3092\u51fa\u529b\u3059\u308b\n<\/code><\/pre>\n<p>\u8868\u793a\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2017\/04\/plain.png\" alt=\"plane\" \/><\/p>\n<p>\u3053\u3053\u307e\u3067\u3092\u884c\u3046\u3068\u3001Web\u753b\u9762\u4e0a\u306bCO2\u6fc3\u5ea6\u304c\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n<h4>\u753b\u9762\u306e\u30c7\u30b6\u30a4\u30f3\u3092\u884c\u3046<\/h4>\n<p>\u3053\u306e\u307e\u307e\u3067\u306f\u305f\u3060\u6570\u5024\u3092\u8868\u793a\u3057\u305f\u3060\u3051\u3067\u3059\u306e\u3067\u3001<br \/>\n\u6570\u5024\u304c\u5927\u304d\u304f\u3066\u3082\u6df1\u523b\u3055\u304c\u4f1d\u308f\u3089\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3068\u3044\u3046\u304b\u4f1d\u308f\u308a\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001<br \/>\n\u30b3\u30fc\u30c9\u3057\u304b\u66f8\u3051\u306a\u3044\u79c1\u306f\u793e\u5185\u306e\u30c7\u30b6\u30a4\u30f3\u304c\u3067\u304d\u308b\u65b9\u306b\u6ce3\u304d\u3064\u3044\u3066\u753b\u9762\u30c7\u30b6\u30a4\u30f3\u3092\u4f5c\u3063\u3066\u3082\u3089\u3044\u3001<br \/>\n\u3053\u3046\u3044\u3063\u305f\u611f\u3058\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2017\/04\/design01.png\" alt=\"design01\" \/><\/p>\n<p>\u95be\u5024\u3092\u8d85\u3048\u308b\u3068\u8868\u793a\u304c\u5909\u308f\u308b\u3088\u3046\u306b\u3082\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3053\u3046\u306a\u308b\u3068\u8ab0\u3067\u3082\u300c\u3084\u3070\u3044\uff01\u63db\u6c17\u3057\u3088\u3046\uff01\u300d\u3068\u306a\u308a\u305d\u3046\u3067\u3059\u306d\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2017\/04\/design02.png\" alt=\"design02\" \/><\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\nFASTIO\u3068\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3092\u9023\u643a\u3067\u304d\u308b\u3068\u6d3b\u7528\u306e\u5e45\u3082\u30b0\u30f3\u3068\u5e83\u304c\u308a\u307e\u3059\u3002<br \/>\n\u305c\u3072\u3001 <a href=\"https:\/\/www.fastio.jp\/fastio-api\/\">FASTIO API<\/a> \u3092\u3054\u5229\u7528\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/cmswp\/wp-content\/uploads\/2017\/04\/kaigishitsu.jpg\" alt=\"kaigishitsu\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01 \u958b\u767a\u90e8\u306e\u6b66\u5185\u3067\u3059\u3002 \u672c\u30a8\u30f3\u30c8\u30ea\u3067\u306fFASTIO API\u306e\u7d39\u4ecb\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"author":9,"featured_media":528,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[33],"_links":{"self":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/103"}],"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\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":33,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":190,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/190"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/media\/528"}],"wp:attachment":[{"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}