{"id":434,"date":"2019-09-28T13:41:30","date_gmt":"2019-09-28T11:41:30","guid":{"rendered":"https:\/\/www.cipv6.de\/worp\/?p=434"},"modified":"2019-09-28T13:41:35","modified_gmt":"2019-09-28T11:41:35","slug":"netatmo-api-how-do-i-get-the-access_token","status":"publish","type":"post","link":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/","title":{"rendered":"Netatmo API : How do I get the access_token ?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">curl:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">curl --location --request POST \"https:\/\/api.netatmo.com\/oauth2\/token\" \\\n  --form \"grant_type=password\" \\\n  --form \"client_id=5a*******21175d8b45ec\" \\\n  --form \"client_secret=NR*******bYylIAigYvaO\" \\\n  --form \"username=be*******eb.de\" \\\n  --form \"password=***111***\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">jQuery:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">var form = new FormData();\nform.append(\"grant_type\", \"password\");\nform.append(\"client_id\", \"5a*******21175d8b45ec\");\nform.append(\"client_secret\", \"NR*******bYylIAigYvaO\");\nform.append(\"username\", \"be*******eb.de\");\nform.append(\"password\", \"***111***\");\n\nvar settings = {\n  \"url\": \"https:\/\/api.netatmo.com\/oauth2\/token\",\n  \"method\": \"POST\",\n  \"timeout\": 0,\n  \"processData\": false,\n  \"mimeType\": \"multipart\/form-data\",\n  \"contentType\": false,\n  \"data\": form\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ruby:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">require \"uri\"\nrequire \"net\/http\"\n\nurl = URI(\"https:\/\/api.netatmo.com\/oauth2\/token\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"content-type\"] = 'multipart\/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'\nrequest.body = \"------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"grant_type\\\"\\r\\n\\r\\npassword\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"client_id\\\"\\r\\n\\r\\n5a*******21175d8b45ec\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"client_secret\\\"\\r\\n\\r\\nNR*******bYylIAigYvaO\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"username\\\"\\r\\n\\r\\nbe*******eb.de\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"password\\\"\\r\\n\\r\\n***111***\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW--\"\n\nresponse = https.request(request)\nputs response.read_body\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Python<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">import requests\nurl = 'https:\/\/api.netatmo.com\/oauth2\/token'\npayload = {'grant_type': 'password',\n'client_id': '5a*******21175d8b45ec',\n'client_secret': 'NR*******bYylIAigYvaO',\n'username': 'be*******eb.de',\n'password': '***111***'}\nfiles = {}\nheaders = {}\nresponse = requests.request('POST', url, headers = headers, data = payload, files = files, allow_redirects=False, timeout=undefined, allow_redirects=false)\nprint(response.text)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Node<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">var https = require('https');\n\nvar options = {\n  'method': 'POST',\n  'hostname': 'api.netatmo.com',\n  'path': '\/oauth2\/token',\n  'headers': {\n  }\n};\n\nvar req = https.request(options, function (res) {\n  var chunks = [];\n\n  res.on(\"data\", function (chunk) {\n    chunks.push(chunk);\n  });\n\n  res.on(\"end\", function (chunk) {\n    var body = Buffer.concat(chunks);\n    console.log(body.toString());\n  });\n\n  res.on(\"error\", function (error) {\n    console.error(error);\n  });\n});\n\nvar postData = \"------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"grant_type\\\"\\r\\n\\r\\npassword\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"client_id\\\"\\r\\n\\r\\n5a*******21175d8b45ec\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"client_secret\\\"\\r\\n\\r\\nNR*******bYylIAigYvaO\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"username\\\"\\r\\n\\r\\nbe*******eb.de\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW\\r\\nContent-Disposition: form-data; name=\\\"password\\\"\\r\\n\\r\\n***111***\\r\\n------WebKitFormBoundary7MA4YWxkTrZu0gW--\";\n\nreq.setHeader('content-type', 'multipart\/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');\n\nreq.write(postData);\n\nreq.end();<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">PHP:<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">&lt;?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https:\/\/api.netatmo.com\/oauth2\/token\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 0,\n  CURLOPT_FOLLOWLOCATION => false,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => array('grant_type' => 'password','client_id' => '5a*******21175d8b45ec','client_secret' => 'NR*******bYylIAigYvaO','username' => 'be*******eb.de','password' => '***111***'),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n} ?><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>curl: jQuery: Ruby: Python Node PHP:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[59],"class_list":["post-434","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Netatmo API : How do I get the access_token ? - cipv6.de<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netatmo API : How do I get the access_token ? - cipv6.de\" \/>\n<meta property=\"og:description\" content=\"curl: jQuery: Ruby: Python Node PHP:\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/\" \/>\n<meta property=\"og:site_name\" content=\"cipv6.de\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-28T11:41:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-09-28T11:41:35+00:00\" \/>\n<meta name=\"author\" content=\"ugu5ma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:site\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ugu5ma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/\"},\"author\":{\"name\":\"ugu5ma\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"headline\":\"Netatmo API : How do I get the access_token ?\",\"datePublished\":\"2019-09-28T11:41:30+00:00\",\"dateModified\":\"2019-09-28T11:41:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/\"},\"wordCount\":15,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/\",\"name\":\"Netatmo API : How do I get the access_token ? - cipv6.de\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\"},\"datePublished\":\"2019-09-28T11:41:30+00:00\",\"dateModified\":\"2019-09-28T11:41:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2019\\\/09\\\/28\\\/netatmo-api-how-do-i-get-the-access_token\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Netatmo API : How do I get the access_token ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\",\"name\":\"cipv6.de\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\",\"name\":\"ugu5ma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"caption\":\"ugu5ma\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/cipv6.de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netatmo API : How do I get the access_token ? - cipv6.de","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/","og_locale":"en_US","og_type":"article","og_title":"Netatmo API : How do I get the access_token ? - cipv6.de","og_description":"curl: jQuery: Ruby: Python Node PHP:","og_url":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/","og_site_name":"cipv6.de","article_published_time":"2019-09-28T11:41:30+00:00","article_modified_time":"2019-09-28T11:41:35+00:00","author":"ugu5ma","twitter_card":"summary_large_image","twitter_creator":"@ugu5ma","twitter_site":"@ugu5ma","twitter_misc":{"Written by":"ugu5ma","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/#article","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/"},"author":{"name":"ugu5ma","@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"headline":"Netatmo API : How do I get the access_token ?","datePublished":"2019-09-28T11:41:30+00:00","dateModified":"2019-09-28T11:41:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/"},"wordCount":15,"commentCount":0,"publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/","url":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/","name":"Netatmo API : How do I get the access_token ? - cipv6.de","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/#website"},"datePublished":"2019-09-28T11:41:30+00:00","dateModified":"2019-09-28T11:41:35+00:00","breadcrumb":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/09\/28\/netatmo-api-how-do-i-get-the-access_token\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cipv6.de\/worp\/"},{"@type":"ListItem","position":2,"name":"Netatmo API : How do I get the access_token ?"}]},{"@type":"WebSite","@id":"https:\/\/www.cipv6.de\/worp\/#website","url":"https:\/\/www.cipv6.de\/worp\/","name":"cipv6.de","description":"","publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cipv6.de\/worp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d","name":"ugu5ma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","caption":"ugu5ma"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g"},"sameAs":["https:\/\/cipv6.de"]}]}},"_links":{"self":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":0,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}