# Get application environment instances (Last 24h) GET https://app.unleash-instance.example.com/api/admin/metrics/instances/{appName}/environment/{environment} Returns an overview of the instances for the given `appName` and `environment` that have received traffic in the last 24 hours. Reference: https://docs.getunleash.io/api/get-application-environment-instances ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get application environment instances (Last 24h) version: endpoint_metrics.getApplicationEnvironmentInstances paths: /api/admin/metrics/instances/{appName}/environment/{environment}: get: operationId: get-application-environment-instances summary: Get application environment instances (Last 24h) description: >- Returns an overview of the instances for the given `appName` and `environment` that have received traffic in the last 24 hours. tags: - - subpackage_metrics parameters: - name: appName in: path required: true schema: type: string - name: environment in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: applicationEnvironmentInstancesSchema content: application/json: schema: $ref: '#/components/schemas/applicationEnvironmentInstancesSchema' '404': description: The requested resource was not found. content: {} components: schemas: ApplicationEnvironmentInstancesSchemaInstancesItems: type: object properties: instanceId: type: string description: >- A unique identifier identifying the instance of the application running the SDK. Often changes based on execution environment. For instance: two pods in Kubernetes will have two different instanceIds sdkVersion: type: - string - 'null' description: >- An SDK version identifier. Usually formatted as "unleash-client-:" clientIp: type: - string - 'null' description: >- An IP address identifying the instance of the application running the SDK lastSeen: type: string format: date-time description: The last time the application environment instance was seen required: - instanceId applicationEnvironmentInstancesSchema: type: object properties: instances: type: array items: $ref: >- #/components/schemas/ApplicationEnvironmentInstancesSchemaInstancesItems description: A list of instances required: - instances ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/metrics/instances/appName/environment/environment")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```