basvandorst/StravaPHP

upload , delete , update activity problem

nirmal-work opened this issue · 7 comments

Upload Activity
Getting error during upload activity like show in below screenshot

image

Here is the which i tried

 $actual_file = realpath('text.gpx');
 $file ='@'.$actual_file;
 $activity_type='ride';
 $data_type='gpx';
 $client->uploadActivity($file, $activity_type, $name = null, $description = null, $private = null, $trainer = null, $data_type, $external_id = null);

When i try to upload it manually with curl.. it's working fine.But Here API call uploadActivity is not working

Update Activity
Also your update activity call is wrong
change in readmi
$client->updateActivity($name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null);

to

 $client->updateActivity($id,$name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null);

delete Activity
In rest.php

Need to change

  public function deleteActivity($id) {
    $path = '/activities/'.$id;
    $result = $this->adapter->delete($path, array());
    return $this->format($result);
  }

to

    public function deleteActivity($id) {
    $path = '/activities/'.$id;
    $result = $this->adapter->delete($path, $this->getHeaders());
    return $this->format($result);
    }

Looks like there is something changed on the Strava side, thanks for your suggestions.

'll try to fix it next week!

Still didn't get the upload activity API call working .

I have the same problem. I can't get the file upload working with a tpx file

Same here. Can't upload a file.

Still not working :(

So - after a phenomenal amount of time trying to debug this issue:

  • the filename needs to be preceded by @
  • it looks like the trainer and private parameters need to be an integer 0/1 rather than null or false

Changing that and I've been able to upload a file using (say):

 $actual_file = realpath('test.tcx');
 $file ='@'.$actual_file;
 $client->uploadActivity($file, 'ride', 'Morning Ride', 'A test', 0, 1, 'tcx', time());

Fixed in 1.0.2. Thanks @harhoo for the fix, and @qligier for the pull request.