Is it possible to upload files using RPC API?


#1

I see in the Portals API documentation a way to store the contents of a file. Is that purely a feature of the Portals application or can we do that with the RPC API also?

I’m asking because my application uses the RPC API exclusively, but I’d love to be able to store various files without introducing a whole new API concept.

Thank you!


#2

Unfortunately, the file upload APIs in Portals are actually part of portals itself. They’re intended for hosting images and other assets for use in Portals applications.

What are you wanting to do with these files? The OneP does have some ability to host files, but only for individual client models. That is to say, you can upload a file in the provisioning system that require an activated client of that client model to authenticate to be able to download the file.

Also, if the file is small and only for use by a single client you could write it to a string dataport, escaping any non-utf8 or base64 encoding for binary files. The limitation here is that a string dataport can only contain 64k bytes. (We have had customers that split their files and write them to several timestamps in a row to get around this, but I don’t suggest doing this as it’s complicated to make it reliable.)


#3

Without going into too many details, my application is supposed to maintain a list of Widgets that it knows about and then make those Widgets available in the form of file downloads to many users who request them. The files will vary in size but will often be a lot bigger than 64K.

It sounds like the Provisioning API is what I should be looking at. The individual client model restriction should not be a problem for me. Thank you!


#4

Great, and for the record you’ll want to see this for details on managing the content available: http://docs.exosite.com/provision/#provisionmanagecontentmodel and this for how a device would then access that content: http://docs.exosite.com/http/#download-content