Skip to content

Storage API

Storage API is used to store and retrieve files from the application storage. Storage is a part of the application and is used to store api definitions, javascript, css, templates, and other resources. Each application has its own storage.

Application directory structure

example:

  • /components - components
  • /pages - pages
  • /js - javascript
  • /css - client css
  • /srs - api definition files
  • /templates - templates

REST API

Storage status

app_{app_name}_read

HTTP
curl {{host}}/api/core/storage/status/{{appname}} \
-H "Authorization: Token {{token}}"

Browse

app_{app_name}_read

  • withsubdir default = true
  • text-ext default = "" example .md,.txt,.sql,.html,.xml,.json,.css,.js
  • kb max kilobytes read default 0kb
  • options:
    • srs: convert all srs to json object (properties.data node) example {{host}}/api/core/storage/browse/erp/srs?options=srs&kb=200
    • json: convert all xml to json object (properties.data node)
    • xls: try to make html preview of xml (content node)
    • scm: get scm status (commit node)
    • code: get code node for visual editor
HTTP
curl {{host}}/api/core/storage/browse/{{appname}}/{{path}} \
-H "Authorization: Token {{token}}"

GET ZIP

app_{app_name}_read

HTTP
curl {{host}}/api/core/storage/zip/{{appname}}/{{path}} \
-H "Authorization: Token {{token}}"

GET FILE

app_{app_name}_read

Get from storage (acl aplied here)

  • w - width
  • h - height
  • o - options
HTTP
curl {{host}}/api/core/storage/get/{{appname}}/{{path}} \
-H "Authorization: Token {{token}}"
HTTP
curl {{host}}/api/core/storage/get/{{appname}}/srs/global.xml \
-H "Authorization: Token {{token}}"

GET META

app_{app_name}_read

Query parameters:

  • kb max kilobytes read default 1000kb
  • textext default= .md,.txt,.sql,.html,.xml,.json,.css,.js,.svg,.log
  • options default = srs json xls code scm
HTTP
curl  {{host}}/api/core/storage/meta/{{appname}}/srs/global.xml?options=none \
-H "Authorization: Token {{token}}"

UPLOAD

app_{app_name}_write

HTTP
POST {{host}}/api/core/storage/upload/{{appname}}
Authorization: Basic api:{{token}}
Content-Type: multipart/form-data; boundary=--MyBoundary

----MyBoundary
Content-Disposition: form-data; name="file"; filename="srs.zip"
Content-Type: application/octet-stream

< C:\git\apps\paanda.app.sparkyb\srs.zip
----MyBoundary--
HTTP
curl -X POST -u api:{{token}} -F "[email protected]" {{host}}/api/core/storage/upload/{{appname}}

SAVE

app_{app_name}_write

HTTP
POST {{host}}/api/core/storage/save/{{appname}}/{{path}}
Authorization: Basic api:{{token}}

DELETE

app_{app_name}_write

HTTP
POST {{host}}/api/core/storage/delete/{{appname}}/{{path}}
Authorization: Basic api:{{token}}