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.

There are three classes in my Parse database. For some reason, fetching data from the second class ContactsData always returns an empty result. Would be great if anyone could provide insights into the problem!

1. The default "Users" class

No problems getting data from this class following examples at https://parse.com/docs/rest#users

ACL column is empty

2. A custom "ContactsData" class. A user is allowed to add name and phone of contacts through our iOS app

Custom columns: name (string), phone (number)

ACL is write: true and read: true.

What I want to do: Fetch all contacts of a given user using python REST API.

METHOD 1:

import json,httplib
import apikeys
import dataset

MY_CLASS = '/1/classes/ContactsData'
connection = httplib.HTTPSConnection('api.parse.com', 443)
connection.connect()
connection.request('GET', MY_CLASS, '', {
       "X-Parse-Application-Id": apikeys.PARSE_APP_ID,
       "X-Parse-REST-API-Key": apikeys.PARSE_REST_API_KEY,})

parseData = json.loads(connection.getresponse().read())
print parseData

Output:

{'results':[]} 

Keep getting this even when there are objects in this class

METHOD 2

Also tried MY_CLASS = '/1/classes/ContactsData/ABCDEFG' where ABCDEFG is the objectId of a particular object.

Output:

{'code': 101, 'error': 'requested resource was not found'}

3. A custom "Testing" class

Exactly the same as MY_CLASS. Just that I did not use ACL, and created the object directly from the Parse dashboard. This time, I was able to get the data using MY_CLASS = '/1/classes/Testing'

share|improve this question

1 Answer 1

You're use REST calls without any logged in user/session-token, so you'll be using default permissions. Unless you've set the class to allow anonymous reads and the row ACL also doesn't restrict it, you wont get any data.

If you want to do the requests as a User that does have read rights to the row you'll need to login and then use the session-token in the headers.

More information can be found here:

https://parse.com/docs/rest#users

share|improve this answer

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.