Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Parse platform Parse.com>;查询约束>;基于用户指针_Parse Platform - Fatal编程技术网

Parse platform Parse.com>;查询约束>;基于用户指针

Parse platform Parse.com>;查询约束>;基于用户指针,parse-platform,Parse Platform,我有一个名为AccountData的类,我想返回与特定用户相关的所有行。在类中,我有一个指向用户表的指针,其中包含他们的“ObjectId” 我尝试了以下对API的调用: string url = "https://api.parse.com/1/classes/AccountData?" + WebUtility.UrlEncode("where={\"user\":\"fvJ8jPjyjx\"}"); 其中fvJ8jPjyjx是我希望与…相关的行的用户的ObjectId api不会抛出任何

我有一个名为AccountData的类,我想返回与特定用户相关的所有行。在类中,我有一个指向用户表的指针,其中包含他们的“ObjectId”

我尝试了以下对API的调用:

string url = "https://api.parse.com/1/classes/AccountData?" + WebUtility.UrlEncode("where={\"user\":\"fvJ8jPjyjx\"}");
其中fvJ8jPjyjx是我希望与…相关的行的用户的ObjectId

api不会抛出任何错误,只会返回:

{"results":[]}
我还使用“用户对象”进行了如下尝试:

public class AccountDataUser
{
    public string __type { get; set; }
    public string className { get; set; }
    public string objectId { get; set; }
}
AccountDataUser user = new AccountDataUser();
user.__type = "Pointer";
user.className = "_User";
user.objectId = objectId;
string jsonUser = JsonConvert.SerializeObject(user);
按如下方式构建对象:

public class AccountDataUser
{
    public string __type { get; set; }
    public string className { get; set; }
    public string objectId { get; set; }
}
AccountDataUser user = new AccountDataUser();
user.__type = "Pointer";
user.className = "_User";
user.objectId = objectId;
string jsonUser = JsonConvert.SerializeObject(user);
但这会抛出一个api错误

有人能帮我返回与“用户”相关的行吗

谢谢

更新

根据Ryans的反馈,我已恢复尝试发送对象

这是正在发送的内容:

GET https://api.parse.com/1/classes/AccountData?where%3D%7B%22user%22%3A%22%7B%22__type%22%3A%22Pointer%22%2C%22className%22%3A%22_User%22%2C%22objectId%22%3A%22fvJ8jPjyjx%22%7D%22%7D HTTP/1.1
Content-Type: application/json
X-Parse-Application-Id: xxxxx
X-Parse-REST-API-Key: xxxxxx
Host: api.parse.com
Connection: Keep-Alive
url是使用以下代码行生成的:

ParseModel.AccountDataUser user = new ParseModel.AccountDataUser();
user.__type = "Pointer";
user.className = "_User";
user.objectId = objectId;

string jsonUser = JsonConvert.SerializeObject(user);

string url = "https://api.parse.com/1/classes/AccountData?" + WebUtility.UrlEncode("where={\"user\":\"" + jsonUser + "\"}"); // this doesn't work
我从API收到的错误是:

{"code":107,"error":"invalid json: {\"user\":\"{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"fvJ8jPjyjx\"}\"}"}

我相信问题在于建立URL。您将JSON包装为字符串,而Parse需要一个对象。如果你把jsonUser的双引号去掉,我打赌这会管用的

string url = "https://api.parse.com/1/classes/AccountData?" + WebUtility.UrlEncode("where={\"user\":" + jsonUser + "}");

您需要传递一个指针对象,以便第二次尝试接近目标。生成的URL是什么样子的?我猜是因为URL格式不正确。对不起,伙计。是的,这是我再次在我的冒险在解析土地-更新了我的问题。。。看到什么了吗?你试过只编码jsonUser字符串而不是整个查询吗?你太棒了想找份工作吗?