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

Getting 400 error on Subscription API Updates

I have successfully verified a subscription web endpoint. Now on changes to any fitbit activity I am getting request on my webhook. But I cannot process those data.

 

I am always getting "POST /webhook HTTP/1.0" 400 - on my webhook end point.

 

Here is my python code for webhook:

 

 

@main.route('/webhook', methods=['POST'])
def get_updates():
    updates = request.form['updates']
    print updates
    #pdb.set_trace()
    resp = make_response('', 204)
    resp.headers['Content-Length'] = 0
return resp

Here first I didn't process the response, I will process it once I confirmed that there is no error.

 

Best Answer
0 Votes
3 REPLIES 3

Hi @salayhin

 

Are you trying to fetch the new data from your webhook endpoint?  After receiving the webhook notification, you should execute the appropriate Web API endpoint to get the data you need.  For example, if you receive this webhook

 

{
    "collectionType": "activities",
    "ownerId": "22PT4L",
    "ownerType": "user",
    "subscriberId": "3",
    "subscriptionId": "123"
}

Then you should execute one of the Activities API endpoints listed here: https://dev.fitbit.com/build/reference/web-api/activity/. 

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes
I am actually not getting any response except 400. I know I have to call
again but I am not getting any response.
Best Answer
0 Votes

Would you provide the API call you're executing to process the data and is returning the  400 error message?  The 400 Bad Request message is "Any case where either endpoint doesn't exist, resource path parameters are invalid, POST request parameters are invalid or no Authentication header is provided. This doesn't include invalid specific resource ids."  

 

I'd like to verify the syntax of the API call you're executing.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes