02-14-2019 05:22
02-14-2019 05:22
Hey all,
I hope somebody can help me. I want to do a GET request with the Search Foods Query (https://api.fitbit.com/1/foods/search.json). I always get status 200 and an empty JSON -> {"foods":[]}.
What am I doing wrong? It does not find any food I am looking for.
This is my code:
Function SearchFood(brand As String, Food As String) As Variant
Dim Url As String
Url = "https://api.fitbit.com/1/foods/search.json"
With FitBitService
.Open "GET", Url
.setRequestHeader "Authorization", "Bearer " & Setting.GetEntry("FitbitToken")
.send ("query=" & Food)
If .Status = 200 Then
SearchFood = .responseText
Else
SearchFood = "Failed"
End If
End With
End Function
Thanks in advance!
Answered! Go to the Best Answer.
02-17-2019 09:36
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.
02-17-2019 09:36
Hi @Matthi1958
I'm wondering if your code is not adding the "?" prior to the query parameters. I executed this endpoint and received data
https://api.fitbit.com/1/foods/search.json?query=oatmeal
Gordon
02-17-2019 09:36
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.
02-17-2019 09:36
Hi @Matthi1958
I'm wondering if your code is not adding the "?" prior to the query parameters. I executed this endpoint and received data
https://api.fitbit.com/1/foods/search.json?query=oatmeal
Gordon
02-18-2019 00:50