Skip to main content

Application Automation

Create an App#

The App's name is unique for your account, and you can’t have multiple times the same app with the same name.

To automate this process, first, we have to get our client id and API token. You have to generate a POST request to Arbitrium (to the following path) with a payload, like the following example:

Request URL:
Staging (Staging)
https://staging-api.edgegap.com/v1/
Production (Prod)
https://api.edgegap.com/v1/

Include your API Token in your Headers like this:

{
'Content-Type': 'application/json',
'Authorization': 'token super_secret_bearer_token_1234'
}

REST example(Prod):

curl --location --request POST 'https://api.edgegap.com/v1/app' \
--header 'Content-Type: application/json' \
--header 'Authorization: token super_secret_bearer_token_1234' \
--data-raw '{
"name": "my-app",
"is_active": true,
"image": "iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg=="
}'

The response will follow this format:

{
"name": "my-app",
"is_active": true,
"image": "iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg==",
"create_time": "2020-08-19 16:56:29.489967",
"last_updated": "2020-08-19 16:56:29.489967"
}

In the example above, you can see that we have the following elements:

You can check the API Reference for more details.

name*string
example: Example App

The Application name
is_active*boolean
example: true

If the application can be deployed at the moment
imagestring
example: iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg==

base64 encoded image to string (300Kb max)
create_time*string($date-time)
example: 2020-08-19 16:56:29.489967

Creation date Timestamp
last_updated*string($date-time)
example: 2020-08-19 16:56:29.489967

Last Update Timestamp

List your Apps#

To get information about all created apps, follow this example of GET.

REST example (Prod):

curl --location --request GET 'https://api.edgegap.com/v1/apps' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"applications": [
{
"name": "my-app",
"is_active": true,
"image": "iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg==",
"create_time": "2020-08-19 16:56:29.489967",
"last_updated": "2020-08-19 16:56:29.489967"
}
]
}

Read a single App#

To get information about a single App, follow this example of GET.

REST example(Prod):

curl --location --request GET 'https://api.edgegap.com/v1/app/my-app' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"create_time": "2020-09-24 19:16:20.008106",
"last_updated": "2020-09-24 19:16:20.008106",
"name": "my-app",
"is_active": true,
"image": "iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg=="
}

Update an App#

To update the configuration of an app, follow this example of PATCH. Excepted for the App name to put in the URL path and the PATCH HTTP verb usage, the parameters are identical to the create.

Only the fields specified will be updated.

REST example:

curl --location --request PATCH 'https://api.edgegap.com/v1/app/my-app' \
--header 'Content-Type: application/json' \
--header 'Authorization: token super_secret_bearer_token_1234' \
--data-raw '{
"is_active": False
}'

The response will follow this format:

{
"name": "my-app",
"is_active": false,
"image": "iVBORw0KGgoAAAANSUhEUg[...]AAABJRU5ErkJggg==",
"create_time": "2020-08-19 16:56:29.489967",
"last_updated": "2020-08-19 16:56:29.489967"
}

Delete an App#

To Delete an App, look at the following example of DELETE. In this example, the app “my-app” will be deleted.

Take note all versions created to this app will be deleted too and not accessible anymore.
If you deleted an app by accident, please contact our support.

REST example(Prod):

curl --location --request DELETE 'https://api.edgegap.com/v1/app/my-app' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"message": "Application successfully deleted"
}

Create a Version#

You cannot have the same version name under a given app.

Include your API Token in your Headers like this:

{
'Content-Type': 'application/json',
'Authorization': 'token super_secret_bearer_token_1234'
}

REST example(Prod):

curl --location --request POST 'https://api.edgegap.com/v1/app/my-app/version' \
--header 'Content-Type: application/json' \
--header 'Authorization: token super_secret_bearer_token_1234' \
--data-raw '{
"name": "v1",
"docker_repository": "docker.io",
"docker_image": "edgegap/demo",
"docker_tag": "0.1",
"private_username": "test-user",
"private_token": "secret-token",
"req_cpu": 1024,
"req_memory": 2048,
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"probe": {
"optimal_ping": 50,
"rejected_ping": 200
},
"envs": [
{
"key": "EDGEGAP_NOT_SECRET",
"value": "Arbitrium is awesome"
},
{
"key": "EDGEGAP_SECRET",
"value": "We can't tell you",
"is_secret": true
}
]
}'

The response will follow this format:

{
"success": true,
"version": {
"create_time": "Thu, 24 Sep 2020 19:16:41 GMT",
"docker_image": "edgegap/demo",
"docker_repository": "docker.io",
"docker_tag": "0.1",
"envs": [
{
"is_secret": false,
"key": "EDGEGAP_NOT_SECRET",
"value": "Arbitrium is awesome"
},
{
"is_secret": true,
"key": "EDGEGAP_SECRET",
"value": "This value is set and encrypted"
}
],
"inject_context_env": false,
"is_active": true,
"last_updated": "Thu, 24 Sep 2020 19:16:41 GMT",
"max_duration": null,
"name": "v1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"private_token": "This value is set and encrypted",
"private_username": "This value is set and encrypted",
"probe": {
"optimal_ping": 50,
"rejected_ping": 200
},
"req_cpu": 1024,
"req_memory": 2048,
"req_video": 0,
"use_telemetry": false
}
}

In this example, you can see that we have the following elements:

You can check the API Reference for more details.

name*string

The Version Name
is_activeboolean

If the Version is active currently in the system
docker_repository*string

The Repository where the image is (i.e. 'docker.io')
docker_image*string

The name of your image (i.e. 'edgegap/demo')
docker_tag*string

The tag of your image (i.e. '0.1.2')
private_usernamestring

The username to access the docker repository
private_tokenstring

The Private Password or Token of the username (We recommend to use a token)
req_cpu*integer
minimum: 100

Units of vCPU needed (1024= 1vcpu)
req_memory*integer
minimum: 100

Units of memory in MB needed (1024 = 1GB)
req_videointeger
minimum: 0

Units of GPU needed (1024= 1 GPU)
max_durationinteger

The Max duration of the game, 0 or null mean unlimited
use_telemetryboolean

Allow injecting ASA Variables
inject_context_envboolean

Allow injecting Context Variables
ports (list)port*integer
minimum: 1
maximum: 65535

The Port to Expose your service
protocol*string

The Protocol 'TCP' or 'UDP'
probe (dict)optimal_ping*integer
minimum: 1

Your optimal value for Latency
rejected_ping*integer
minimum: 1

Your reject value for Latency
envs (list)key*string

The Key where the Environment Variable will be set
value*string

The Value to retrieve at the Key
is_secretboolean

This will encrypt the value in our database, won't be readable by an external source

List your Versions for a single App#

To get information about all created apps.

REST example(Prod):

curl --location --request GET 'https://api.edgegap.com/v1/app/my-app/versions' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"pagination": {
"has_next": false,
"has_previous": false,
"next_page_number": null,
"number": 1,
"paginator": {
"num_pages": 1
},
"previous_page_number": null
},
"total_count": 1,
"versions": [
{
"create_time": "Thu, 24 Sep 2020 19:16:41 GMT",
"docker_image": "edgegap/demo",
"docker_repository": "docker.io",
"docker_tag": "0.1",
"envs": [
{
"is_secret": false,
"key": "EDGEGAP_NOT_SECRET",
"value": "Arbitrium is awesome"
},
{
"is_secret": true,
"key": "EDGEGAP_SECRET",
"value": "This value is set and encrypted"
}
],
"inject_context_env": false,
"is_active": true,
"last_updated": "Thu, 24 Sep 2020 19:16:41 GMT",
"max_duration": null,
"name": "v1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"private_token": "This value is set and encrypted",
"private_username": "This value is set and encrypted",
"probe": {
"optimal_ping": 50,
"rejected_ping": 200
},
"req_cpu": 1024,
"req_memory": 2048,
"req_video": 0,
"use_telemetry": false
}
]
}

Read a single Version.#

To get information about a single App, look at the following example of GET.

REST example(Prod):

curl --location --request GET 'https://api.edgegap.com/v1/app/my-app/version/v1' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"create_time": "Thu, 24 Sep 2020 19:38:28 GMT",
"docker_image": "edgegap/demo",
"docker_repository": "docker.io",
"docker_tag": "0.1",
"envs": [
{
"is_secret": false,
"key": "EDGEGAP_NOT_SECRET",
"value": "Arbitrium is awesome"
},
{
"is_secret": true,
"key": "EDGEGAP_SECRET",
"value": "This value is set and encrypted"
}
],
"inject_context_env": false,
"is_active": true,
"last_updated": "Thu, 24 Sep 2020 19:38:28 GMT",
"max_duration": null,
"name": "v1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"private_token": "This value is set and encrypted",
"private_username": "This value is set and encrypted",
"probe": {
"optimal_ping": 50,
"rejected_ping": 200
},
"req_cpu": 1024,
"req_memory": 2048,
"req_video": 0,
"use_telemetry": false
}

Update a Version#

To update the configuration about a created version, look at the following example of PATCH.

Excepted for the App name and the Version Name to put in the URL path and the PATCH HTTP verb usage, the parameters are identical to the create.

Only the fields specified will be updated

!! Important !! The following fields will overwrite your current one if specified

  • ports
  • envs

Example: If you specified port 80 and 443 for your version during the POST, and in the PATCH, you specified only port 80, port 443 will be removed.

To clear all values, simple give and empty array.

REST example(Prod):

curl --location --request PATCH 'https://api.edgegap.com/v1/app/my-app/version/v1' \
--header 'Content-Type: application/json' \
--header 'Authorization: token super_secret_bearer_token_1234' \
--data-raw '{
"ports": [
{
"port": 443,
"protocol": "TCP"
}
]
}'

The response will follow this format:

{
"success": true,
"version": {
"create_time": "Thu, 24 Sep 2020 19:16:41 GMT",
"docker_image": "edgegap/demo",
"docker_repository": "docker.io",
"docker_tag": "0.1",
"envs": [
{
"is_secret": false,
"key": "EDGEGAP_NOT_SECRET",
"value": "Arbitrium is awesome"
},
{
"is_secret": true,
"key": "EDGEGAP_SECRET",
"value": "This value is set and encrypted"
}
],
"inject_context_env": false,
"is_active": true,
"last_updated": "Thu, 24 Sep 2020 19:16:41 GMT",
"max_duration": null,
"name": "v1",
"ports": [
{
"port": 443,
"protocol": "TCP"
}
],
"private_token": "This value is set and encrypted",
"private_username": "This value is set and encrypted",
"probe": {
"optimal_ping": 50,
"rejected_ping": 200
},
"req_cpu": 1024,
"req_memory": 2048,
"req_video": 0,
"use_telemetry": false
}
}

Delete a Version#

To Delete a Version, look at the following example of DELETE. In this example, Version “v1” will be deleted.

If you deleted a version by accident, please contact our support.

REST example(Prod):

curl --location --request DELETE 'https://api.edgegap.com/v1/app/my-app/version/v1' \
--header 'authorization: token super_secret_token_1234'

The response will follow this format:

{
"message": "Version v1 of App my-app is deleted",
"success": true
}