I've been trying to use the webhook subscriptions function of the new Google Health API following the documentation and I was testing the create subscriber endpoint to register a new subscriber with the following request body using Postman:
{
"endpointUri": "<AWS API Gateway URL>",
"subscriberConfigs": [
{
"dataTypes": ["steps"],
"subscriptionCreatePolicy": "AUTOMATIC"
}
],
"endpointAuthorization": {
"authorization_token": "Bearer R4nd0m5tr1ng123 "
}
}
I tried putting in the actual authorization token in the field as well, but I keep getting the same response:
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"authorization_token\" at 'subscriber.endpoint_authorization': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "subscriber.endpoint_authorization",
"description": "Invalid JSON payload received. Unknown name \"authorization_token\" at 'subscriber.endpoint_authorization': Cannot find field."
}
]
}
]
}
}
Would love some pointers on how to solve this!
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.
I think the "authorization_token" param is suppose to be "secret".
{
"endpointUri": "<AWS API Gateway URL>",
"subscriberConfigs": [
{
"dataTypes": ["steps"],
"subscriptionCreatePolicy": "AUTOMATIC"
}
],
"endpointAuthorization": {
"secret": "Bearer R4nd0m5tr1ng123 "
}
}
My body is validated this way, however I get a 403 error after that myself
Best Answer
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.
Hi @nsyifa
Thanks for sharing your question.
The error you're encountering is because the example you followed was based on a previous beta version of the API. This was changed in our latest release.
To fix this, you can find the updated technical details in our reference documentation here: EndpointAuthorization Reference. We will go through and update the example and documentation to reflect this change. Please let us know if this helps you resolve the issues!
Best Answer
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.
Hi @shapelink
Thank you for your patience.
For clarification, you changed the endpointAuthorization "authorization_token" to "secret". Are you able to verify your subscriber now? Can you tell me what you are doing when you get the 403 error?
Best Answer
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.
Hi @nsyifa
After changing endpointAuthorization "authorization_token" to "secret", are you able to verify your subscriber?
Best Answer