我正在玩Meteor,我正在尝试对我的apispark帐户进行API调用,查看Meteor文档:http文档。
1- Meteor.http.get("http://www.google.com"));运行良好,返回我的谷歌页面。
2- Meteor.http.get("https://myApi.apispark.net:443/v1/campaigns"));
Exception while invoking method 'getApiCampains' Error: failed [401] {"code":403,"description":"The server understood the request, but is refusing to fulfill it","reasonPhrase":"Forbidden"}这似乎很好,因为我没有提供任何建议。
3- Meteor.http.get("https://myApi.apispark.net:443/v1/campaigns", {auth : '123:456'});
Exception while invoking method 'getApiCampains' Error: failed [401] {"code":401,"description":"The request requires user authentication", "reasonPhrase":"Unauthorized"}其中123是我的用户名,456是我的私钥。这基本上就是我的错误所在,前面的两个例子表明我的api调用是通用的,而不是这个调用。
有人能看到我做错了什么吗?当我检查10亿次时,我的凭证和我在apispark的帐户上的一样。
由于这是我第一次使用Meteor包并进行API调用,我可能很容易忘记一些东西,可能是一些选项或其他什么?
任何帮助或提示将是非常感谢的!谢谢
发布于 2015-06-05 14:46:19
你能试着用卷发确保你的证件是正确的吗?以下是一个示例:
curl -u 123:456 https://myApi.apispark.net:443/v1/campaigns我只是试了一试,这对我来说很管用。确保使用端点部分中的Web级别定义的凭据。它们是针对您的Web的,并且与您的帐户不同。
文档中的这个链接可以帮助您:http://restlet.com/technical-resources/apispark/guide/create/test。
希望它能帮到你,蒂埃里
https://stackoverflow.com/questions/30667935
复制相似问题