Can we store files in Portals through API


#1

Hello guys,

We´ve developed a js lib for our widgets, with sole intention of applying changes to all portals using this lib. Can we host it directly in Portals through API?

Lib is composed of a .js file, folders with images and folders with css templates.

Regards,


#2

@katesclau,
Yes, portals has a file system, here is the API to upload files, you can see the other APIs for this FS here:
http://docs.exosite.com/portals/#update-file-content

Here is an example of posting a file to it, assuming you are a Portals domain admin:


#3

Thanks, this did the trick.

We are using js libs for our portal deployment, so we can update all widgets with only a lib change. But as we upload the same file twice, it creates an unique folder to hold this new copy.

Can we replace the files to the same folders too?

Regards,


#4

I believe the ‘PUT’ command will work for you to replace content.

curl -i -u 'user@example.com' -X PUT 'https://example.exosite.com/api/portals/v1/fs/demo/blue.png' -H 'Content-Type: ' -d @exosite-blue.png

#5

Great, this did the trick! Thanks