Application API

Manage application deployments programmatically

Overview

The Applications API provides functionality to create, read, update, and delete application deployments. Applications are associated with InstallImages and can be assigned to devices. The API supports comprehensive filtering, pagination, tag management, and customer permission validation.

POST Create Application

Creates a new application.

Request

{
  "cmd": "application.create",
  "name": "My Application",
  "imagecode": "ROCKYHARD9",
  "customerid": 1234,
  "description": "Application description",
  "deviceid": 5678,
  "configurationjson": "{\"key\":\"value\"}",
  "tags": [
    {"name": "environment", "data": "production"},
    {"name": "team", "data": "devops"}
  ]
}
<?php
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'cmd' => 'application.create',
    'name' => 'My Application',
    'imagecode' => 'ROCKYHARD9',
    'customerid' => 1234,
    'description' => 'Application description',
    'deviceid' => 5678,
    'configurationjson' => '{"key":"value"}',
    'tags' => [
        ['name' => 'environment', 'data' => 'production'],
        ['name' => 'team', 'data' => 'devops']
    ]
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_JWT_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests

response = requests.post(
    'https://api.rackcorp.net/api/rest/v2.9/json.php',
    json={
        'cmd': 'application.create',
        'name': 'My Application',
        'imagecode': 'ROCKYHARD9',
        'customerid': 1234,
        'description': 'Application description',
        'deviceid': 5678,
        'configurationjson': '{"key":"value"}',
        'tags': [
            {'name': 'environment', 'data': 'production'},
            {'name': 'team', 'data': 'devops'}
        ]
    },
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN',
        'Content-Type': 'application/json'
    }
)

data = response.json()
curl -X POST "https://api.rackcorp.net/api/rest/v2.9/json.php" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "application.create",
    "name": "My Application",
    "imagecode": "ROCKYHARD9",
    "customerid": 1234,
    "description": "Application description",
    "deviceid": 5678,
    "configurationjson": "{\"key\":\"value\"}",
    "tags": [
      {"name": "environment", "data": "production"},
      {"name": "team", "data": "devops"}
    ]
  }'

Parameters

Parameter Type Required Description
cmd string Yes Must be "application.create"
name string Yes Application name (must be unique per customer)
imagecode string Yes InstallImageCode - must exist and customer must have access
customerid integer No Customer ID (defaults to authenticated user's customer)
description string No Application description
deviceid integer No Device ID to assign application to (validated if provided)
configurationjson string/object No JSON configuration data (max 64KB, must be valid JSON)
tags array No Array of tag objects (max 128 tags)

Tag Object Structure

{
  "name": "string (max 64 chars)",
  "data": "string (max 1024 chars)"
}

Response

{
  "code": "OK",
  "message": "Successfully Created",
  "application": {
    "id": 1,
    "name": "My Application",
    "description": "Application description",
    "customerid": 1234,
    "deviceid": 5678,
    "installimageid": 5,
    "imagecode": "ROCKYHARD9",
    "status": "ACTIVE",
    "operationalstatus": "PENDING",
    "datecreated": 1699123456,
    "datemodified": 1699123456,
    "version": 0,
    "configurationjson": "{\"key\":\"value\"}",
    "tags": {
      "environment": "production",
      "team": "devops"
    }
  }
}

GET Get Application

Retrieves a single application by ID.

Request

{
  "cmd": "application.get",
  "id": 1
}
<?php
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=application.get&id=1');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_JWT_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests

response = requests.get(
    'https://api.rackcorp.net/api/rest/v2.9/json.php',
    params={
        'cmd': 'application.get',
        'id': 1
    },
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
)

data = response.json()
curl -X GET "https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=application.get&id=1" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=application.get&id=1
Authorization: Bearer YOUR_JWT_TOKEN

Parameters

Parameter Type Required Description
cmd string Yes Must be "application.get"
id integer Yes Application ID

Response

{
  "code": "OK",
  "application": {
    "id": 1,
    "name": "My Application",
    "description": "Application description",
    "customerid": 1234,
    "deviceid": 5678,
    "installimageid": 5,
    "imagecode": "ROCKYHARD9",
    "status": "ACTIVE",
    "operationalstatus": "RUNNING",
    "datecreated": 1699123456,
    "datemodified": 1699123456,
    "version": 2,
    "configurationjson": "{\"key\":\"value\"}",
    "tags": {
      "environment": "production",
      "team": "devops"
    }
  }
}

GET List Applications

Retrieves a list of applications with filtering, pagination, and sorting.

Request

{
  "cmd": "application.getall",
  "resStart": 0,
  "resWindow": 50,
  "keyword": "search term",
  "status": "ACTIVE"
}
<?php
$params = http_build_query([
    'cmd' => 'application.getall',
    'resStart' => 0,
    'resWindow' => 50,
    'keyword' => 'search term',
    'status' => 'ACTIVE'
]);

$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php?' . $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_JWT_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests

response = requests.get(
    'https://api.rackcorp.net/api/rest/v2.9/json.php',
    params={
        'cmd': 'application.getall',
        'resStart': 0,
        'resWindow': 50,
        'keyword': 'search term',
        'status': 'ACTIVE'
    },
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
)

data = response.json()
curl -X GET "https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=application.getall&resStart=0&resWindow=50&keyword=search%20term&status=ACTIVE" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=application.getall&resStart=0&resWindow=50&keyword=search%20term&status=ACTIVE
Authorization: Bearer YOUR_JWT_TOKEN

Parameters

Parameter Type Required Description
cmd string Yes Must be "application.getall"
resStart integer No Pagination start offset (default: 0)
resWindow integer No Number of results per page (default: 50000)
lastmodified integer No UTC timestamp - only return applications modified since this time
id integer No Filter by application ID
customerid integer No Filter by customer ID
name string No Filter by name (LIKE search)
keyword string No Search in name and description (LIKE search)
status string No Filter by ApplicationStatus (ACTIVE, INACTIVE, DELETED)
operationalstatus string No Filter by ApplicationOperationalStatus (PENDING, DEPLOYING, TESTING, RUNNING, DELETING, DELETED)
deviceid integer No Filter by device ID
tags array No Filter by tags - must match ALL tags (AND logic)
sort array No Array of sort objects (max 3 sorts)
Note: configurationjson is not included in getall results for performance. Use application.get to retrieve full details including configuration.

Response

{
  "code": "OK",
  "message": "Applications Retrieved Successfully",
  "count": 25,
  "applications": [
    {
      "id": 1,
      "name": "My Application",
      "description": "Application description",
      "customerid": 1234,
      "deviceid": 5678,
      "installimageid": 5,
      "status": "ACTIVE",
      "operationalstatus": "RUNNING",
      "datecreated": 1699123456,
      "datemodified": 1699123456,
      "version": 2,
      "tags": {
        "environment": "production",
        "team": "devops"
      }
    }
  ]
}

PUT Update Application

Updates an existing application.

Request

{
  "cmd": "application.update",
  "id": 1,
  "name": "Updated Application Name",
  "description": "Updated description",
  "status": "ACTIVE",
  "operationalstatus": "RUNNING",
  "deviceid": 5678,
  "tags": [
    {"name": "environment", "data": "staging"},
    {"name": "team", "data": "devops"}
  ]
}
<?php
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'cmd' => 'application.update',
    'id' => 1,
    'name' => 'Updated Application Name',
    'description' => 'Updated description',
    'status' => 'ACTIVE',
    'operationalstatus' => 'RUNNING',
    'deviceid' => 5678,
    'tags' => [
        ['name' => 'environment', 'data' => 'staging'],
        ['name' => 'team', 'data' => 'devops']
    ]
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_JWT_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests

response = requests.put(
    'https://api.rackcorp.net/api/rest/v2.9/json.php',
    json={
        'cmd': 'application.update',
        'id': 1,
        'name': 'Updated Application Name',
        'description': 'Updated description',
        'status': 'ACTIVE',
        'operationalstatus': 'RUNNING',
        'deviceid': 5678,
        'tags': [
            {'name': 'environment', 'data': 'staging'},
            {'name': 'team', 'data': 'devops'}
        ]
    },
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN',
        'Content-Type': 'application/json'
    }
)

data = response.json()
curl -X PUT "https://api.rackcorp.net/api/rest/v2.9/json.php" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "application.update",
    "id": 1,
    "name": "Updated Application Name",
    "description": "Updated description",
    "status": "ACTIVE",
    "operationalstatus": "RUNNING",
    "deviceid": 5678,
    "tags": [
      {"name": "environment", "data": "staging"},
      {"name": "team", "data": "devops"}
    ]
  }'

Parameters

All parameters from application.create are supported, except imagecode, configurationjson, and customerid which cannot be changed. The id parameter is required.

Response

{
  "code": "OK",
  "message": "Successfully Updated",
  "application": {
    "id": 1,
    "name": "Updated Application Name",
    "description": "Updated description",
    "customerid": 1234,
    "deviceid": 5678,
    "installimageid": 5,
    "imagecode": "ROCKYHARD9",
    "status": "ACTIVE",
    "operationalstatus": "RUNNING",
    "datecreated": 1699123456,
    "datemodified": 1699123500,
    "version": 3,
    "configurationjson": "{\"key\":\"value\"}",
    "tags": {
      "environment": "staging",
      "team": "devops"
    }
  }
}

DELETE Delete Application

Soft deletes an application (sets status to DELETED).

Request

{
  "cmd": "application.delete",
  "id": 1
}
<?php
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'cmd' => 'application.delete',
    'id' => 1
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_JWT_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests

response = requests.delete(
    'https://api.rackcorp.net/api/rest/v2.9/json.php',
    json={
        'cmd': 'application.delete',
        'id': 1
    },
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN',
        'Content-Type': 'application/json'
    }
)

data = response.json()
curl -X DELETE "https://api.rackcorp.net/api/rest/v2.9/json.php" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "application.delete",
    "id": 1
  }'

Parameters

Parameter Type Required Description
cmd string Yes Must be "application.delete"
id integer Yes Application ID to delete

Response

{
  "code": "OK",
  "message": "Application deleted"
}
Note: This is a soft delete. The application status is set to DELETED and operational status to DELETED. The record remains in the database.

Notes

  • Version Field: The version field is automatically incremented on each update or delete operation
  • Soft Delete: Deleted applications remain in the database with status DELETED
  • Tag Replacement: Updating tags replaces all existing tags with the new set
  • Configuration JSON: Once set during creation, configuration JSON cannot be modified
  • InstallImage: Once set during creation, the InstallImage cannot be changed
  • Pagination: Default window size is 50000, but smaller values are recommended for better performance
  • Tag Filtering: Tag filtering uses AND logic - all specified tags must match
  • Sorting: Maximum 3 sort fields are supported per request

Error Responses

If an error occurs, the API will return a response with code: "FAULT":

{
  "code": "FAULT",
  "message": "Error message",
  "error": {
    "field1": "Error message 1",
    "field2": "Error message 2"
  }
}