Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

REST API

David Ebbo edited this page Jan 29, 2015 · 47 revisions

This API is accessed the same way as the git endpoint. e.g. if your git URL is https://yoursite.scm.azurewebsites.net/yoursite.git, then the API to get the list of deployments will be https://yoursite.scm.azurewebsites.net/deployments.

The credentials you use are the same as when you git push. See Deployment-credentials for more details.

scm

Note: in older builds, use /live/scm instead of /api/scm

GET /api/scm/info
Get information about the repository

POST /api/scm/clean	
Clean the repository, using 'git clean -xdff'

DELETE /api/scm	
Delete the repository

Command

POST /api/command
Executes an arbitrary command line and return its output

The JSON body of the post should look like this, passing the command and the folder it should run in:

{
    "command": 'echo Hello World',
    "dir": 'site\\repository'
}

VFS

The VFS API is based on https://github.com/c9/vfs-http-adapter. Paths with trailing slashes are treated as directories.

GET /api/vfs/{path}
Gets a file at path

GET /api/vfs/{path}/
Lists files at directory specified by path.

PUT /api/vfs/{path}
Puts a file at path.

PUT /api/vfs/{path}/
Creates a directory at path. The path can be nested, e.g. `folder1/folder2`.

DELETE /api/vfs/{path}
Delete the file at path.

Zip

The Zip API allows downloading folders as zip files, or expanding zip files into folders.

GET /api/zip/{path}
Zip up and download the specified folder. The zip doesn't include the top folder itself.

PUT /api/zip/{path}
Upload a zip file which gets expanded into the specified folder. Existing files are not deleted
unless they need to be overwritten by files in the zip. The path can be nested (e.g. `folder1/folder2`), and needs to exist.

Deployment

GET /api/deployments
Get the list of all deployments

GET /api/deployments/{id}
Get a deployment

PUT /api/deployments/{id}
Deploy a previous deployment

DELETE /api/deployments/{id}
Delete a deployment

GET /api/deployments/{id}/log
Get the list of log entries for a deployment

GET /api/deployments/{id}/log/{logId}
Get the list of log entry details for a log entry

POST /deploy
Payload: { format: 'basic', url: 'https://github.com/SomeOrg/SomeRepo.git' } 
Trigger a new deployment from that repository 

POST /deploy
Payload: { format: 'basic', url: 'https://github.com/SomeOrg/SomeRepo.git#<commit_sha>' } 
Trigger a new deployment from that repository for certain commit. 

SSHKey

PUT /api/sshkey	
Set the private key. The supported key format is privacy enhanced mail (PEM)

GET /api/sshkey	
Get the public key.  Optional: ?ensurePublicKey=1 to generate if none exist.

Environment

GET /api/environment
Get the Kudu version

Settings

POST /api/settings
Create or change one or more settings

Sample body:
{
   "foo": "hello",
   "bar": "bye"
}

GET /api/settings
Get the list of all settings

GET /api/settings/{key}
Get the value of a setting

DELETE /api/settings/{key}
Delete a setting

Diagnostics

GET /api/dump	
Get all the diagnostic logs as a zip file

Diagnostics/Settings

POST /api/diagnostics/settings
Create or change a setting

GET /api/diagnostics/settings
Get the list of all settings

GET /api/diagnostics/settings/{key}	
Get the value of a setting

DELETE /api/diagnostics/settings/{key}
Delete a setting

Sample of available settings.

{
    "AzureDriveEnabled": false(|true),
    "AzureDriveTraceLevel": "Error(|Information|Warning|Verbose)",
    "AzureTableEnabled": false(|true),
    "AzureTableTraceLevel": "Error(|Information|Warning|Verbose)",
    "AzureBlobEnabled": false(|true),
    "AzureBlobTraceLevel": "Error(|Information|Warning|Verbose)",
}

Logs

GET /api/logs/recent
Retrieve application logs found in the LogFiles\Application folder, starting with the most recent entries. 
The following query string parameter(s) are supported:
- top: the number of log entries to return (default is 100, maximum is 1000)

SiteExtensions

GET /api/extensionfeed
List all extension package infos available on the online (remote) server.  The following query strings are supported.
- filter: matching string

GET /api/siteextensions
List all extension package infos currently installed.  The following query strings are supported.
- filter: matching string

GET /api/extensionfeed/{id}
Get a package info with {id} from remote store.

GET /api/siteextensions/{id}
Get a package info with {id} currently installed.

PUT /api/siteextensions/{id}
Install or update the package to local machine. The payload is the package info returned by List/Get apis above.

DELETE /api/siteextensions/{id}
Uninstall the package with {id}.

Sample of using REST API with PowerShell

$username = "`$website"
$password = "pwd"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))

$apiUrl = "https://{sitename}.scm.azurewebsites.net/api/zip/site/wwwroot"
$filePath = "C:\Temp\books.zip"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method PUT -InFile $filePath -ContentType "multipart/form-data"
Clone this wiki locally