/cloud/stack/environment/get


GET https://api.sitehost.nz/1.0/cloud/stack/environment/get.json

Get environment variables for a container on the stack.
This only works for the environment variables stored in [container name].env

Query Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client that the stack belongs to.Example: 1
serverstringYesThe server where the stack resides.Example: ch-servername
projectstringYesThe name of the stack.Example: cc567a321b123c
servicestringYesThe name of the service within the stack, that you wish to get environment variables from. For most stacks which have only one service, this is the same as the project/stack name.Example: cc567a321b123c

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://api.sitehost.nz/1.0/cloud/stack/environment/get.json?apikey=your_key_here&client_id=1&server=ch-servername&project=cc567a321b123c&service=cc567a321b123c", false);

xmlHttp.send();

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.0/cloud/stack/environment/get.json?apikey=your_key_here&client_id=1&server=ch-servername&project=cc567a321b123c&service=cc567a321b123c");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.0/cloud/stack/environment/get.json?apikey=your_key_here&client_id=1&server=ch-servername&project=cc567a321b123c&service=cc567a321b123c")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
import requests

uri = 'https://api.sitehost.nz/1.0/cloud/stack/environment/get.json?apikey=your_key_here&client_id=1&server=ch-servername&project=cc567a321b123c&service=cc567a321b123c'

response = requests.get(uri)

Response

200:

application/json
{
  "return": [
    {
      "name": "TEST_VAR",
      "content": "value1"
    },
    {
      "name": "TEST_VAR2",
      "content": "value2"
    }
  ],
  "msg": "Successful",
  "status": true
}