1

I am trying to get relation objects from a class. What I am doing looks something like this, but it is not working. Does anybody know what I could be doing wrong?

  curl -X GET \

   -H "X-Parse-Application-Id: xxxxx" \

   -H "X-Parse-REST-API-Key: xxxx" \

   --data-urlencode 'where={"$relatedTo":{"object":{"__type”:"Relation","className”:”Dog","objectId":"xkxJOVMcMv"},"key”:"dogs"}}' \

   https://api.parse.com/1/classes/owner

Thank you !

1 Answer 1

2

I assume that your owner class has a relation field to Dog class and you want to get all the dogs someone owns via that relation. You should then to do this instead:

curl -X GET \
-H "X-Parse-Application-Id: xxxxx" \
-H "X-Parse-REST-API-Key: xxxx" \
--data-urlencode 'where={"$relatedTo":{"object":{"__type":"Pointer","className":"owner","objectId":"<ownerid>"},"key":"dogs"}}' \
https://api.parse.com/1/classes/Dog
Sign up to request clarification or add additional context in comments.

4 Comments

Sorry my code was missing a curly bracket so I edited it to be correct.
Basically there is an owner clas with I have a relation column that has a relation to the Dog class where there will be multiple dogs that belong to that owner.
Well the code above should give you all the dogs for that owner given that you replace <ownerid> with the owner objectId
Ah, I was missing a curly bracket at the end. Problem resolved! Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.