Created
November 14, 2012 22:21
-
-
Save cbrammer/4075274 to your computer and use it in GitHub Desktop.
Log Fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var jsonData = { title: 'GF lvl 3 #1', | |
| userId: 50a40be63c0eff0000000011, | |
| finished: true, | |
| workoutId: 503becb25fb61e3261000003, | |
| routeId: undefined, | |
| equipmentIds: [], | |
| startTime: 1299110400000, | |
| endTime: 1299110473000, | |
| timestamp: 1299110400000, | |
| type: 'run', | |
| notes: 'GF lvl 3 #1', | |
| distance: 48.280334936776896, | |
| duration: 73000, | |
| elevation_gain: '', | |
| elevation_loss: '', | |
| max_hr: '', | |
| min_hr: '', | |
| calories: '12', | |
| how_felt: '', | |
| difficulty: '9', | |
| weather: '', | |
| surface: '', | |
| average_pace: '4.45', | |
| location: '' } | |
| var url = 'https://api.ifit-beta.com/log/workout/create?userId=50a40be63c0eff0000000011'; | |
| request({ | |
| url: url, | |
| method: 'POST', | |
| form: { | |
| log: JSON.stringify(jsonData) | |
| } | |
| }, function(err, res, body) { | |
| console.log('saving log result', url, jsonData, err, body); | |
| if (err) return cb(err); | |
| if(body.success != true) return cb(new Error('couldnt log workout, bad response')); | |
| console.log('successful posting of log!'); | |
| cb(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment