User Tools

Action disabled: source

Back to Users API

Get User Upload Folder Contents


Use the GET /files transaction to retrieve the directory list (a tree in JSON format) of the contents of the user's upload area.

Synopsis

Directory list object

A successful GET /files transaction returns an object containing the list of contents of the user's upload area. The list has a tree structure and is returned in JSON format. The structure is like below:

{
  "name": "/Shoebox_v8.9",
  "fileName": "/Shoebox_v8.9",
  "fileSize": 0,
  "children": [
    {
      "fileName": "2030_Heathrow_a1fi_50_percentile_TRY.epw",
      "fileSize": 1439809,
      "children": [],
      "name": "2030_Heathrow_a1fi_50_percentile_TRY.epw (1.44 MB)"
    },
    ...
  ]
}

An actual returned object is shown below:

{
  "fileName": "/Shoebox_v8.9",
  "open": true,
  "nocheck": true,
  "fileSize": 0,
  "children": [
    {
      "fileName": "2030_Heathrow_a1fi_50_percentile_TRY.epw",
      "open": false,
      "nocheck": false,
      "fileSize": 1439809,
      "children": [],
      "name": "2030_Heathrow_a1fi_50_percentile_TRY.epw (1.44 MB)"
    },
    {
      "fileName": "2050_Heathrow_a1fi_50_percentile_TRY.epw",
      "open": false,
      "nocheck": false,
      "fileSize": 1440039,
      "children": [],
      "name": "2050_Heathrow_a1fi_50_percentile_TRY.epw (1.44 MB)"
    },
    {
      "fileName": "2080_Heathrow_a1fi_50_percentile_TRY.epw",
      "open": false,
      "nocheck": false,
      "fileSize": 1441330,
      "children": [],
      "name": "2080_Heathrow_a1fi_50_percentile_TRY.epw (1.44 MB)"
    },
    {
      "fileName": "cntr_Heathrow_TRY.epw",
      "open": false,
      "nocheck": false,
      "fileSize": 1438895,
      "children": [],
      "name": "cntr_Heathrow_TRY.epw (1.44 MB)"
    },
    {
      "fileName": "joblist_out.csv",
      "open": false,
      "nocheck": false,
      "fileSize": 4837,
      "children": [],
      "name": "joblist_out.csv (4.84 KB)"
    },
    {
      "fileName": "jobs.txt",
      "open": false,
      "nocheck": false,
      "fileSize": 3203,
      "children": [],
      "name": "jobs.txt (3.20 KB)"
    },
    {
      "fileName": "project.json",
      "open": false,
      "nocheck": false,
      "fileSize": 7822,
      "children": [],
      "name": "project.json (7.82 KB)"
    },
    {
      "fileName": "shoebox.idf",
      "open": false,
      "nocheck": false,
      "fileSize": 223949,
      "children": [],
      "name": "shoebox.idf (223.9 KB)"
    }
  ],
  "name": "/Shoebox_v8.9"
}

Example using curl://

Send the /user command using curl:

curl -b cookies https://api.ensims.com/users/api/files

On success, the user's upload directory contents will be returned in a JSON tree object. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following lines:

import requests

# Existing cookies are expected to be stored in the variable 'cookies'
r = requests.get('https://api.ensims.com/users/api/files', cookies=cookies)

# Show returned object  
r.json()


Site Tools