访问PARSE.COM时未经授权的错误代码

时间:2013-05-06 01:55:41

标签: c# rest parse-platform

我使用下面的代码访问Parse.com上的课程

    public void GetBook()
    {
        string RequestString = "https://api.parse.com/1/classes/Book";
        string ApplicationId = "my Application ID";
        string RestApiKey = "my REST API Key";

        WebRequest webRequest = WebRequest.Create(RequestString);

        NetworkCredential streetCred = new NetworkCredential(ApplicationId, RestApiKey);
        webRequest.Credentials = streetCred;
        webRequest.Method = "GET";
        webRequest.Timeout = 100000;
        HttpWebResponse b = (HttpWebResponse)webRequest.GetResponse();
    }

这总是导致401 Unauthorized响应。 我究竟做错了什么 ?

1 个答案:

答案 0 :(得分:0)

我找到了自己问题的答案!

似乎所需的密钥(NetworkCredentials中的第二个参数)应该是主密钥而不是REST API密钥。