Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error 400 bad request when trying to subscribe to an application

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

 

Best Answer
0 Votes
0 REPLIES 0