I have a class called AccountData and I would like to return all rows that relate to a particular user. In the class I have a Pointer to the User table which contains their "ObjectId"
I have tried with the following call to the API:
string url = "https://api.parse.com/1/classes/AccountData?" + WebUtility.UrlEncode("where={\"user\":\"fvJ8jPjyjx\"}");
where the fvJ8jPjyjx is the ObjectId of the user I want rows relating to...
The api doesn't throw any errors just returns:
{"results":[]}
I have also tried it using a "User Object" as follows:
public class AccountDataUser
{
public string __type { get; set; }
public string className { get; set; }
public string objectId { get; set; }
}
building the object as follows:
AccountDataUser user = new AccountDataUser();
user.__type = "Pointer";
user.className = "_User";
user.objectId = objectId;
string jsonUser = JsonConvert.SerializeObject(user);
but this throws an api error.
Can anyone help me return the rows relating to a "user" please?
Thanks
UPDATE
Based on Ryans feedback I have reverted to trying to send an object...
This is what is being sent:
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
The url is built with this line of code:
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
And the error I receive from the API is:
{"code":107,"error":"invalid json: {\"user\":\"{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"fvJ8jPjyjx\"}\"}"}