BlackMouse
BlackMouse

Reputation: 4552

Get all classes in Parse-server

I'm writing a backup job, and need to fetch all classes in Parse-server, so I can then query all rows and export them.

How do I fetch all classes?

Thanks

Upvotes: 1

Views: 2535

Answers (1)

coweye
coweye

Reputation: 164

Query the schemas collection.

GET /parse/schemas

Probably need to use the masterkey on the query. Not sure what language you're writing your job in but should be simple for you to create a REST query or create a node.js script and use the javascript/node api

--Added after comment below --

var Parse = require('parse/node').Parse;
Parse.serverURL = "http://localhost:23740/parse";
Parse.initialize('APP_ID', 'RESTKEY', 'MASTERKEY');

var Schema = Parse.Object.extend("_SCHEMA");
var query = new Parse.Query(Schema);

query.find({
  success : (results) => {
  console.log(JSON.stringify(results));
},
 error : (err) => {
 console.log("err : " + JSON.stringify(err));
 }});

Upvotes: 5

Related Questions