OpenC3 / cosmos

OpenC3 COSMOS
https://openc3.com
Other
111 stars 31 forks source link

Expose storage directory listing API in script for Ruby/Python #1692

Open ryanmelt opened 2 weeks ago

ryanmelt commented 2 weeks ago

Basically a method like this:

endpoint = "/openc3-api/storage/files/OPENC3_CONFIG_BUCKET/DEFAULT/targets/INST/lib"
response = $api_server.request('get', endpoint, query: { bucket: 'OPENC3_CONFIG_BUCKET' }, scope: $openc3_scope)
result = JSON.parse(response.body)
files = result[1]
files.each do |file|
  puts "#{file["name"]}: #{file["modified"]} : #{file["size"]} bytes"
end