Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

If this has already been answered please feel free to direct to a relevant Q&A. The only answer I have found is what I am already trying and I am not getting the result I am hoping for. Also looked over the REST API documentation for Parse and no luck in figuring this out. That being said...

I have two classes in Parse.com: Invites and Events Each Invite has a relation to an Event. Ideally I would like to query the Invite but also receive event_name and event_address from the Events object related to the invite.

This is the curl query I have been trying (pulled from the other answer I mentioned and Parse.com docs):

       curl -X GET \
       -H "X-Parse-Application-Id: xxxxx" \
       -H "X-Parse-REST-API-Key: xxxxxx" \
       --data-urlencode 'where={"$relatedTo":{"object":{"__type":"Pointer","className":"Events","objectId":"Yp04m8QT2N"},"key":"event_name"}}' \
       https://api.parse.com/1/classes/Invites/XXQ0191KSv

Yp04m8QT2N is the related 'Events' objectId, event_name is in the Events class

I am getting results from the invite class but was expecting event_name to be included in the results. What am I missing? I haven't gotten as far as including multiple columns from events so if you could save me another question it would be much appreciated!

Response:

    {"createdAt":"2014-06-07T20:26:04.877Z","event_objectId":{"__type":"Relation","className":"Events"},"invite_email":"[email protected]","invite_firstname":"Steven","invite_lastname":"Carlton","invite_opendate":{"__type":"Date","iso":"2014-06-08T19:16:00.000Z"},"invite_phone":"1234567890","invite_sentdate":{"__type":"Date","iso":"2014-06-07T20:26:00.000Z"},"objectId":"XXQ0191KSv","updatedAt":"2014-06-08T19:17:17.980Z"}

Thanks for your help!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

if it really is a pointer, then as docs say in 'retreiving objects' section , you can just do

--data-urlencode 'include=$pointer' 

where $pointer is the field name in Invites whose value is the pointer to Events.

If you are useing a relation type instead of a pointer then you can not flatten the query in this way.

share|improve this answer
    
Man I can't tell you how many times I looked at those docs. I did try include as well but did not try the pointer column from Invites. Once I did this, I got the expect result. '--data-urlencode 'include=event_objectId'' was what I needed for this specific example. –  Steven Carlton Jun 9 at 13:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.