0

I'm trying to connect to the withings API using RestSharp. But it is return an error to me, 503 : Invalid Params.

Client

        try
        {
            var client = new RestClient(ResourceUrl)
            {
                Authenticator = OAuth1Authenticator.ForProtectedResource(Credentials.ConsumerKey, Credentials.ConsumerSecret, Credentials.OAuthToken, Credentials.OAuthSecret)
            };
            ((OAuth1Authenticator) client.Authenticator).ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
            var request = new RestRequest("measure",Method.GET);
            request
                .AddQueryParameter("action", "getmeas")
                .AddQueryParameter("userid", Credentials.ExternalUserId)
                .AddQueryParameter("startDate", startDate.ToUnixTime().ToString())
                .AddQueryParameter("enddate", endDate.ToUnixTime().ToString());
            var response = client.Execute(request);
            wmBPList = GetWM_BloodPressure(response.Content);
        }

Generated Url

"https://wbsapi.withings.net/v2/measure?action=getmeas&userid=12829536&startDate=1491750000&enddate=1491757200"
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188

1 Answers1

1

I worked few years ago with the v1 withing API and I have this problem and it was the order of the params in the query. Nothing was stated in the documentation.

I don't know if it was always the case in v2 but you can try to reorder your params.

Jowy
  • 93
  • 2
  • 9