I am trying to create a subscription. I have verified my subscription API. I am using this curl given in documentation here to create a new subscription, but it is failing with 400 Bad request. Please help
Curl command
curl -X POST "https://api.fitbit.com/1/user/-/body/apiSubscriptions/9pgqWLScRzNuJ8C5HZwp4WizuG92.json" \
-H "accept: application/json" \
-H "Authorization: Bearer <a valid token>" \
-H "content-length: 10000"This is the response
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
According to RFC 7230, section 3.3.2, the POST HTTP requests requires the Content-Length header field containing the anticipated size of the payload body. The subscription endpoint does not have a payload body, therefore the size is 0 (zero). The API is designed correctly.
Best Answer