SDKs
Hosting
Read your web hosting sites and the SFTP and SSH details for reaching their files.
client.hosting reads a project's web hosting
sites and tells you where to reach their files. Every method needs
hosting:read.
const { data: sites } = await client.hosting.list();
const { data: access } = await client.hosting.access(sites[0].id);
console.log(`sftp -P ${access.sftp.port} ${access.username}@${access.host}`);| Method | Description |
|---|---|
list() | Every site in the project that has not been removed. |
get(siteId, ...) | One site. Pass credentials: true (credentials=True in Python) to include its sftpPassword. |
access(siteId) | The username, host, sftp.port, and ssh.port and ssh.enabled for reaching the site's files. |
get with credentials returns the site's SFTP password, and it needs no scope
beyond hosting:read. Treat any key carrying hosting:read as able to change
your site's files.
To upload a build from CI, cosmoner upload
fetches these details with the API key and syncs a directory over SFTP, with no
password of its own to store.