简体   繁体   中英

Withings Returning 503 : Invalid Params

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"

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM