Skip to content

Latest commit

 

History

History
117 lines (97 loc) · 2.44 KB

packages.md

File metadata and controls

117 lines (97 loc) · 2.44 KB

Packages API Reference

Packages

Represents an individual package on VirtShell.

Method HTTP request Description
install POST /packages/
upgrade PUT /packages
remove DELETE /packages

Note: URIs relative to https://www.yourhostname.com/api/virtshell/v1, unless otherwise noted.

Resource representation

{
  "packages": [
      {"name": "package_name1"},
      {"name": "package_name2"}
  ],
  "instances": [ 
      {"name": "Host_", "range": "[1-3]"}, 
      {"name": "database_001"}
  ],
  "tags": [
    {"name": "db"},
    {"name": "web"}
  ]
}

###Examples###

POST /api/virtshell/v1/packages

Install one or more packages:

curl -sv -X POST \
  -H 'accept: application/json' \
  -H "Content-Type: text/plain" \
  -H 'X-VirtShell-Authorization: UserId:Signature' \
  -d '{ "packages": [{"name": "git"}, {"name": "nginx"}],
        "instances": [{"name": "WebServer_", "range": "[1-3]"}]}' \
   'http://localhost:8080/api/virtshell/v1/install_packages'

Response:

HTTP/1.1 202 Accepted
Content-Type: application/json
{ 
  "install_package": "in progress"
}

PUT /api/virtshell/v1/packages

Upgrade one or more packages:

curl -sv -X PUT \
  -H 'accept: application/json' \
  -H "Content-Type: text/plain" \
  -H 'X-VirtShell-Authorization: UserId:Signature' \
  -d '{ "packages": [{"name": "git"}, {"name": "nginx"}],
        "instances": [{"name": "WebServer_", "range": "[1-3]"}]}' \
   'http://localhost:8080/api/virtshell/v1/upgrade_packages'

Response:

HTTP/1.1 202 Accepted
Content-Type: application/json
{ 
  "upgrade_packages": "in progress"
}

DELETE /api/virtshell/v1/packages

Remove one or more packages:

curl -sv -X DELETE \
  -H 'accept: application/json' \
  -H "Content-Type: text/plain" \
  -H 'X-VirtShell-Authorization: UserId:Signature' \
  -d '{ "packages": [{"name": "git"}, {"name": "nginx"}],
        "instances": [{"name": "WebServer_", "range": "[1-3]"}]}' \
   'http://localhost:8080/api/virtshell/v1/packages'

Response:

HTTP/1.1 202 Accepted
Content-Type: application/json
{ 
  "remove_packages": "in progress"
}