Skip to content

Implement file 'ls' API on Agent #382

Closed
coder/coder
#16736

Description

@spikecurtis

Add a new HTTP endpoint to the Agent HTTP API. This API will be in support of Coder Desktop File Sync, so that our GUI can list directories in the workspace when setting up a file sync.

  • API endpoint: api/v0/ls
  • Request format: (example is for /home/coder on a Unix system)
{
  // path components as an ordered list
  "path": ["home", "coder"], 
  // also accepts "home", in which case path is interpreted relative to the home dir
  "relativity": "root" 
}
  • Response format:
{
  // the absolute path we are returning
  "absolute_path": ["home", "coder"],
  "contents": [
    {
      "name": "repos",
      "dir": true,
    },
    {
      "name": "Downloads",
      "dir": true,
    }
  ]
}
  • Errors
    • 403 Forbidden - if the agent doesn’t have permission to list the directory
    • 404 File Not Found - if the directory doesn’t exist
    • We also write a standard codersdk.Response message for any unsuccessful requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions