Reputation: 1100
Is there a way to check if a Class with a certain name exists in Parse?
In my db I am creating classes on the fly and want to check if a Class exists before querying it.
I know one way would be to store all the names of the class in a dedicated class just with the names of the created classes and then to query that. I am wondering if there is a more direct approach
Upvotes: 1
Views: 567
Reputation: 862
You can make a get request on the "schema api" for the class whose existence you want to check.
If the class is not found then an error message is returned clearly stating that the class doesn't exist/ not found.
Here is the link showing how to make a fetch request on the class schema:
http://parseplatform.github.io/docs/rest/guide/#fetch-the-schema
Hope it helps!
Upvotes: 0
Reputation: 18699
I think there is not yet a method implemented to check if the class exist. What you can do, is do a query on the class name and if it returns an empty list of objects, it is fair to assume that the class does not exist.
Upvotes: 3