How do I read my file?


OK guys, after trying dozens of permutations I have to conclude that something is weird when you try to access the contents of file.

result = platform.api.get("files/"+filename); 

It give me a correct message if there is no file there. It give me null if it CSV file. When I tried a .txt file it returned: {“resource”:{"sta <===== that was it/!??? there is no “sta” in my file.


handled in support.

For those who stumble upon this later, you cannot stream contents of a file (which is the default action) in a script, as the scripting environment cannot properly allocate the memory. You have to tell the api call you want content returned in a json object.
result = platform.api.get("files/"+filename+"?include_properties=true&content=true);
This will return the content in a base64 encoded string in a json object. You will need to decode this in your application.
Future releases will have the ability to return the data unencoded (for the case of plain text.)