06-29-2017 08:43
06-29-2017 08:43
Hello,
After the authentication step working fine, we're trying to register the user to a subscription.
When doing this, we keep having a 400 Bad request error.
We're doing it via curl under php. Here is the following code used, where the memberId and access token are correctly set.
We suspect the error would come from either the headers or the url.
$header_data = array("Authorization: Bearer ".$response->access_token, "X-Fitbit-Subscriber-Id:myappname"); $sub_url = "https://api.fitbit.com/1/user/-/activities/apiSubscriptions/".$this->member->id.".json"; curl_setopt($ch2, CURLOPT_URL, $sub_url); curl_setopt($ch2, CURLOPT_HTTPHEADER, $header_data); curl_setopt($ch2, CURLOPT_POST, true); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch2);
Thanks in advance for any feedback