【问题标题】:Withings Returning 503 : Invalid ParamsWithings 返回 503:参数无效
【发布时间】:2017-03-08 00:51:31
【问题描述】:

我正在尝试使用 RestSharp 连接到 withings API。但它向我返回了一个错误,503 : Invalid Params

客户

        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);
        }

生成的网址

"https://wbsapi.withings.net/v2/measure?action=getmeas&userid=12829536&startDate=1491750000&enddate=1491757200"

【问题讨论】:

    标签: c# .net oauth restsharp withings


    【解决方案1】:

    几年前我使用 v1 withing API 工作过,但我遇到了这个问题,这是查询中参数的顺序。文档中没有说明任何内容。

    我不知道在 v2 中是否总是如此,但您可以尝试重新排序参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-20
      • 2012-09-28
      • 2021-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-15
      • 2013-12-21
      相关资源
      最近更新 更多