{"id":3526,"date":"2013-01-19T12:32:42","date_gmt":"2013-01-19T17:32:42","guid":{"rendered":"http:\/\/kodegeek.com\/blog\/?p=3526"},"modified":"2014-07-04T10:55:11","modified_gmt":"2014-07-04T14:55:11","slug":"nike-rest-api","status":"publish","type":"post","link":"http:\/\/kodegeek.com\/blog\/2013\/01\/19\/nike-rest-api\/","title":{"rendered":"Nike+ REST API"},"content":{"rendered":"<p>Last year <a href=\"http:\/\/kodegeek.com\/blog\/2011\/10\/12\/hackeando-mis-datos-en-nikerunning-com\/\">I started playing<\/a> with the Nike+ website; So Nike finally decided to release a proper API to interact with their website. The API is small yet looks functional, but I am having a hard time trying to figure out how to reproduce the results from a simple REST client:<\/p>\n<pre lang=\"Bash\">\r\nMacintosh:python josevnz$ .\/nikeplus_unit_test.py \r\nsend: 'GET \/me\/sport?access_token=XXXXXX HTTP\/1.1\\r\\nHost: api.nike.com:443\\r\\nAccept-Encoding: identity\\r\\nContent-Type: application\/jsonrequest\\r\\nAccept: application\/jsonrequest\\r\\nAppid: Kodegeek\/NikePlus\\r\\n\\r\\n'\r\nE\r\n======================================================================\r\nERROR: test_getAggregateSportData (__main__.TestNikePlus)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \".\/nikeplus_unit_test.py\", line 16, in test_getAggregateSportData\r\n    activities = activity.getAggregateSportData(True)\r\n  File \"\/Users\/josevnz\/Documents\/src\/python\/com\/kodegeek\/fitness\/nikeplus\/activity\/wrapper.py\", line 30, in getAggregateSportData\r\n    res = con.getresponse()\r\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/httplib.py\", line 1013, in getresponse\r\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/httplib.py\", line 402, in begin\r\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/httplib.py\", line 360, in _read_status\r\n  File \"\/System\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/socket.py\", line 430, in readline\r\nerror: [Errno 54] Connection reset by peer\r\n\r\n----------------------------------------------------------------------\r\nRan 1 test in 0.570s\r\n\r\nFAILED (errors=1)\r\n<\/pre>\n<p>Contacted the developers, lets see how it goes. But it is exiting, so many possibilities!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last year I started playing with the Nike+ website; So Nike finally decided to release a proper API to interact with their website. The API is small yet looks functional, but I am having a hard time trying to figure out how to reproduce the results from a simple REST client: Macintosh:python josevnz$ .\/nikeplus_unit_test.py send: <a class=\"read-more\" href=\"http:\/\/kodegeek.com\/blog\/2013\/01\/19\/nike-rest-api\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[654,194,438,239],"tags":[98,721,736],"_links":{"self":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts\/3526"}],"collection":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/comments?post=3526"}],"version-history":[{"count":3,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts\/3526\/revisions"}],"predecessor-version":[{"id":3672,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts\/3526\/revisions\/3672"}],"wp:attachment":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/media?parent=3526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/categories?post=3526"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/tags?post=3526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}