thiagolocatelli / parse4j

Java Library to deal with Parse (parse.com) REST API
http://thiagolocatelli.github.io/parse4j
143 stars 117 forks source link

[code=109, error=unauthorized] in ParseFile #54

Closed diogo10 closed 8 years ago

diogo10 commented 8 years ago

hii guys, Can I upload a xls? or I need authoreize something in my app? I checked my ACL is public/read/write.....follow my code..

Path path = Paths.get(USER_DIRECTORY + "/workbook.xls");
            byte[] data = Files.readAllBytes(path);
            final ParseFile parseFile = new ParseFile("test1.xls", data);
            parseFile.save(new SaveCallback() {

                @Override
                public void done(ParseException pe) {
                    System.out.println("pe =" + pe);
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
diogo10 commented 8 years ago

I found my error....I was saving the ParseFile in one object that I didn't initiate the parse4j...see the correct way in my case....


public void saveReport(String name, ParseFile file, String login) throws Exception {
        file.save();
        ParseObject gameScore = new ParseObject("Reports");
        gameScore.put("name", name);
        gameScore.put("login", login);
        gameScore.put("myfile", file);
        gameScore.save();
    }
SeloSlav commented 7 years ago

I had the same error for:

ParseQuery<ParseObject> query = ParseQuery.getQuery("Yeet");
        query.getInBackground("4tD9TIIIhv", new GetCallback<ParseObject>() {
            public void done(ParseObject object, ParseException e) {
                if (e == null) {
                    System.out.println("ParseObject printed successfully! " + object);
                } else {
                    e.printStackTrace();
                }
            }
        });

What do you think is going wrong here?