Created
May 27, 2016 00:18
-
-
Save davimacedo/a4d1e189c485dab52678df6bc4b2d93d to your computer and use it in GitHub Desktop.
Example of exporting data with cloud functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST \ | |
-H "X-Parse-Application-Id: YKjNQyNBBsaJpRlcSRxBfR3yKCGdU395XzZfqjdB" \ | |
-H "X-Parse-REST-API-Key: JBDMxg9uyvbq7FQdd44EtSKDLdDlIrRrP6EIvFZJ" \ | |
-H "Content-Type: application/json" \ | |
-d '{"exportClass": "MyClass"}' \ | |
https://parseapi.back4app.com/functions/export > out.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parse.Cloud.define("export", function(request, response) { | |
var ExportObject = Parse.Object.extend(request.params.exportClass); | |
var query = new Parse.Query(ExportObject); | |
query.find({ success: response.success, error: response.error }); | |
}); |
Hi!
Found this post as I was looking for a way to export files as csv. However, when I used this to my cloud code what I got is a file with a json format. Is there any way to export directly as a csv file?
I tried changing the out.json to out.csv, the result is a csv file with the wrong formatting. I could do with a json to csv converter but it seems to be one step extra.
Yes, I would also like to know how to import directly to a CSV just like the old Parse.com method.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍