Hello,
We’re running into some limitation regarding the payload size to an API call.
That’s why we resorted to a file upload as according to the documentation this can be 5GB.
Couple of questions on uploading a file to experience using the Losant API.
- When you do the create file call, you need to give a file size. But it seems this file size number is not used? As i’ve noticed you can input any number in here and it does not impact the uploading.
- It seems the allowed file size is smaller than 5GB. I’ve hit a limit somewhere between 5 and 10 MB. Is this correct?
It sounds like you are running into the difference between two different methods we support for uploading files …
After making a Files: Post request, you can then make a File: Upload request with the file contents directly to the Losant API at the file ID returned in the first request. Based on your description it sounds like this is what you are doing currently.
However, Losant’s API has a maximum of 10MB on request size, so trying to upload a 5GB file would fail.
The alternative is to use the signed URL returned in the Files: Post or File: Patch request and upload the file to the storage provider directly. (This is the method we use when uploading files through the Losant user interface.) We have more information in our API documentation.
We also have a File Upload template that demonstrates this in a browser context; I recommend importing that template into your application, even if only to see a code example that you can apply to your specific use case.
When you do the create file call, you need to give a file size. But it seems this file size number is not used?
This is true; we use this value primarily as a feedback mechanism to the user to let them know, in the Losant UI, the progress of the file upload in the second step. When the upload completes, we use the file size returned by the underlying storage provider (AWS S3) as the source of truth.
Based on this question, I’m going to file a documentation update ticket to clarify this in our Files docs. Thanks for the feedback.