import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
app_short = client.fastedge.apps.replace(
app_id=0,
)
print(app_short.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/fastedge"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
appShort, err := client.Fastedge.Apps.Replace(
context.TODO(),
0,
fastedge.AppReplaceParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", appShort.ID)
}
curl --request PUT \
--url https://api.gcore.com/fastedge/v1/apps/{app_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"binary": 12345,
"status": 1,
"name": "my-edge-app",
"template": 123,
"env": {
"var1": "value1",
"var2": "value2"
},
"rsp_headers": {
"header1": "value1",
"header2": "value2"
},
"debug": false,
"comment": "Production API gateway for customer portal",
"secrets": {},
"stores": {}
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
binary: 12345,
status: 1,
name: 'my-edge-app',
template: 123,
env: {var1: 'value1', var2: 'value2'},
rsp_headers: {header1: 'value1', header2: 'value2'},
debug: false,
comment: 'Production API gateway for customer portal',
secrets: {},
stores: {}
})
};
fetch('https://api.gcore.com/fastedge/v1/apps/{app_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/fastedge/v1/apps/{app_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'binary' => 12345,
'status' => 1,
'name' => 'my-edge-app',
'template' => 123,
'env' => [
'var1' => 'value1',
'var2' => 'value2'
],
'rsp_headers' => [
'header1' => 'value1',
'header2' => 'value2'
],
'debug' => false,
'comment' => 'Production API gateway for customer portal',
'secrets' => [
],
'stores' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.gcore.com/fastedge/v1/apps/{app_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"binary\": 12345,\n \"status\": 1,\n \"name\": \"my-edge-app\",\n \"template\": 123,\n \"env\": {\n \"var1\": \"value1\",\n \"var2\": \"value2\"\n },\n \"rsp_headers\": {\n \"header1\": \"value1\",\n \"header2\": \"value2\"\n },\n \"debug\": false,\n \"comment\": \"Production API gateway for customer portal\",\n \"secrets\": {},\n \"stores\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/fastedge/v1/apps/{app_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"binary\": 12345,\n \"status\": 1,\n \"name\": \"my-edge-app\",\n \"template\": 123,\n \"env\": {\n \"var1\": \"value1\",\n \"var2\": \"value2\"\n },\n \"rsp_headers\": {\n \"header1\": \"value1\",\n \"header2\": \"value2\"\n },\n \"debug\": false,\n \"comment\": \"Production API gateway for customer portal\",\n \"secrets\": {},\n \"stores\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 2,
"name": "<string>",
"status": 123,
"binary": 123,
"api_type": "<string>",
"plan_id": 123,
"url": "<string>",
"comment": "<string>",
"debug_until": "2023-11-07T05:31:56Z",
"template": 123,
"template_name": "<string>",
"networks": [
"<string>"
],
"upgradeable_to": 123,
"plan": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Update an app
Replace the complete configuration of an existing application. All fields must be provided - use PATCH for partial updates.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
app_short = client.fastedge.apps.replace(
app_id=0,
)
print(app_short.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/fastedge"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
appShort, err := client.Fastedge.Apps.Replace(
context.TODO(),
0,
fastedge.AppReplaceParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", appShort.ID)
}
curl --request PUT \
--url https://api.gcore.com/fastedge/v1/apps/{app_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"binary": 12345,
"status": 1,
"name": "my-edge-app",
"template": 123,
"env": {
"var1": "value1",
"var2": "value2"
},
"rsp_headers": {
"header1": "value1",
"header2": "value2"
},
"debug": false,
"comment": "Production API gateway for customer portal",
"secrets": {},
"stores": {}
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
binary: 12345,
status: 1,
name: 'my-edge-app',
template: 123,
env: {var1: 'value1', var2: 'value2'},
rsp_headers: {header1: 'value1', header2: 'value2'},
debug: false,
comment: 'Production API gateway for customer portal',
secrets: {},
stores: {}
})
};
fetch('https://api.gcore.com/fastedge/v1/apps/{app_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/fastedge/v1/apps/{app_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'binary' => 12345,
'status' => 1,
'name' => 'my-edge-app',
'template' => 123,
'env' => [
'var1' => 'value1',
'var2' => 'value2'
],
'rsp_headers' => [
'header1' => 'value1',
'header2' => 'value2'
],
'debug' => false,
'comment' => 'Production API gateway for customer portal',
'secrets' => [
],
'stores' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.gcore.com/fastedge/v1/apps/{app_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"binary\": 12345,\n \"status\": 1,\n \"name\": \"my-edge-app\",\n \"template\": 123,\n \"env\": {\n \"var1\": \"value1\",\n \"var2\": \"value2\"\n },\n \"rsp_headers\": {\n \"header1\": \"value1\",\n \"header2\": \"value2\"\n },\n \"debug\": false,\n \"comment\": \"Production API gateway for customer portal\",\n \"secrets\": {},\n \"stores\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/fastedge/v1/apps/{app_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"binary\": 12345,\n \"status\": 1,\n \"name\": \"my-edge-app\",\n \"template\": 123,\n \"env\": {\n \"var1\": \"value1\",\n \"var2\": \"value2\"\n },\n \"rsp_headers\": {\n \"header1\": \"value1\",\n \"header2\": \"value2\"\n },\n \"debug\": false,\n \"comment\": \"Production API gateway for customer portal\",\n \"secrets\": {},\n \"stores\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 2,
"name": "<string>",
"status": 123,
"binary": 123,
"api_type": "<string>",
"plan_id": 123,
"url": "<string>",
"comment": "<string>",
"debug_until": "2023-11-07T05:31:56Z",
"template": 123,
"template_name": "<string>",
"networks": [
"<string>"
],
"upgradeable_to": 123,
"plan": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
ID of the app
Body
App details
ID of the WebAssembly binary to deploy
x >= 112345
Status code:
0 - draft (inactive)
1 - enabled
2 - disabled
5 - suspended
0 <= x <= 51
Unique application name (alphanumeric, hyphens allowed)
1 - 64^[a-z0-9][a-z0-9-]*[a-z0-9]$"my-edge-app"
Template ID
Environment variables
Show child attributes
Show child attributes
{ "var1": "value1", "var2": "value2" }
Extra headers to add to the response
Show child attributes
Show child attributes
{ "header1": "value1", "header2": "value2" }
kafka, none Enable verbose debug logging for 30 minutes. Automatically expires to prevent performance impact.
false
Optional human-readable description of the application's purpose
1024"Production API gateway for customer portal"
Application secrets
Show child attributes
Show child attributes
Application edge stores
Show child attributes
Show child attributes
Response
Application updated successfully, returns updated metadata
App ID
x >= 1App name
Status code:
0 - draft (inactive)
1 - enabled
2 - disabled
3 - hourly call limit exceeded
4 - daily call limit exceeded
5 - suspended
Binary ID
Wasm API type
Application plan ID
App URL
Description of the binary
When debugging finishes
Template ID
Template name
Networks
ID of the binary the app can be upgraded to
Application plan name
Was this page helpful?