API
37 watchers
Dec 2014
9:33pm, 10 Dec 2014
4,611 posts
|
Badger
Hi Fetch, any updates on the API? I'm using it for uploads again at the moment (using a Suunto watch and using Python to upload runs to here and Training Peaks); wondering if there is any chance of editing things like equipment and maybe even custom fields? Also, being able to pull the exact time of a workout would be really good for deciding what to upload and what's already there; hour is usually good enough, but parkrun mornings often turn into a run and a bike within the same hour. Flanker, did you get anywhere with FIT files? |
Dec 2014
12:01am, 11 Dec 2014
15,452 posts
|
flanker
not looked at it yet. Got sidetracked with learning Swift!
|
Mar 2015
8:34pm, 5 Mar 2015
15,666 posts
|
flanker
still sidetracked, but dreaming ups interesting ideas with the mapping/geolocation stuff on iDevices... Now if fetchpoint was exposed via the API (or maybe by a scrape? hmmm...) then I can envisage a great app for bug busting / coin gathering / etc. |
Jun 2015
5:20pm, 2 Jun 2015
15,904 posts
|
flanker
right, finally starting to play with this, but struggling at the first step as I've no idea how to authenticate against the API as I'm not a PHP guy. From what I can make out from the example I need to POST through a base64 encoded combination of user +":"+secret ? At the moment I'm getting the response: NSHTTPURLResponse: 0x7fdb08c180f0 { URL: api.fetcheveryone.com } { status code: 200, headers { "Cache-Control" = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; Connection = "Keep-Alive"; "Content-Length" = 0; "Content-Type" = "text/html; charset=utf-8"; Date = "Tue, 02 Jun 2015 16:15:46 GMT"; Expires = "Thu, 19 Nov 1981 08:52:00 GMT"; "Keep-Alive" = "timeout=5, max=100"; Pragma = "no-cache"; Server = "Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny10 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0"; "Set-Cookie" = "PHPSESSID=0e9013b6e140ca3f6b71d6d4c7cbc74a; path=/"; "X-Powered-By" = "PHP/5.2.6-1+lenny10"; } } which I assume means I've not authorised anything. I'm getting no data or error back. |
Jun 2015
5:59pm, 2 Jun 2015
5,093 posts
|
Badger
I'm not a PHP guy either, but I got it going with Python. Your content-length should be 51, so that's not right. content-type should be application/json Did you have 'Accept': "application/json" in the headers as well as the authorization bit? |
Jun 2015
6:20pm, 2 Jun 2015
5,094 posts
|
Badger
Scratch that, what you get is what I see if I send garbage as the base64 encoded users=":"+secret. I was confused by the 200 status code. Have you used hex instead of text for the user and secret values? |
Jun 2015
8:08pm, 2 Jun 2015
15,905 posts
|
flanker
Thanks. Yes, had the accept header, or at least I think I did! Assuming how I'm passing the header pairs is correct. Expect that my encoding is the issue, as I'm not too sure right now what I'm trying to do there or (yet) how the pre-built Swift API works - I've just been following a pattern so far, but will dig into it later tonight. |
Jun 2015
10:33am, 3 Jun 2015
15,909 posts
|
flanker
Grrrr. Typo. Missed out the trailing space on "Basic " Getting somewhere now. Although I'm having to work out the request/response protocols by trial and error from looking at the HTTP responses and data. I'm sure it's widely documented on t'web, but by the time I've worked out the PHP I can have worked it out by looking at the raw data! |
Jun 2015
11:21am, 4 Jun 2015
15,917 posts
|
flanker
All working on iOS (other than upload, which I can't be bothered to code unless I can find some useful purpose for it. One question - I'm sometimes getting a FAIL response with an invalid access token. I' assuming this is the access token expiring? If so, does anyone know what its TTL is? |
Jun 2015
12:06pm, 4 Jun 2015
5,105 posts
|
Badger
60 seconds I believe; I was refreshing after 55 and have had no problems with very lengthy sessions. I've made tools for multiple uploads of Suunto sml files and tcx files to FE, and a few people have used the tcx uploader to get old data into new FE accounts. I started playing with |
Related Threads
- Coders Oct 2024
- Pi Club Jan 2022
- Android App Apr 2021
- Coders Aug 2020
- Wireframe tools May 2019
- Tapiriik? Mar 2019
- Oracle club Sep 2018
- Raspberry Pi Jan 2018
- Calling All Coders Jan 2014
- Upload from apple watch Jul 2024