import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
application_variant = client.application_variants.create(
account_id="account_id",
application_spec_id="application_spec_id",
configuration={
"edges": [{
"from_field": "from_field",
"from_node": "from_node",
"to_field": "to_field",
"to_node": "to_node",
}],
"nodes": [{
"id": "id",
"application_node_schema_id": "text_input_schema",
}],
},
name="name",
version="V0",
)
print(application_variant)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
applicationVariant, err := client.ApplicationVariants.New(context.TODO(), sgp.ApplicationVariantNewParams{
Body: sgp.ApplicationVariantNewParamsBodyApplicationVariantV0Request{
AccountID: sgp.F("account_id"),
ApplicationSpecID: sgp.F("application_spec_id"),
Configuration: sgp.F(sgp.ApplicationConfigurationParam{
Edges: sgp.F([]sgp.ApplicationEdgeParam{{
FromField: sgp.F("from_field"),
FromNode: sgp.F("from_node"),
ToField: sgp.F("to_field"),
ToNode: sgp.F("to_node"),
}}),
Nodes: sgp.F([]sgp.ApplicationNodeParam{{
ID: sgp.F("id"),
ApplicationNodeSchemaID: sgp.F(sgp.ApplicationNodeApplicationNodeSchemaIDTextInputSchema),
}}),
}),
Name: sgp.F("name"),
Version: sgp.F(sgp.ApplicationVariantNewParamsBodyApplicationVariantV0RequestVersionV0),
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", applicationVariant)
}curl --request POST \
--url https://api.egp.scale.com/v4/application-variants \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"configuration": {
"nodes": [
{
"id": "<string>",
"configuration": {}
}
],
"edges": [
{
"from_node": "<string>",
"to_node": "<string>",
"from_field": "<string>",
"to_field": "<string>"
}
],
"metadata": {}
},
"version": "<string>",
"application_spec_id": "<string>",
"account_id": "<string>",
"description": "<string>",
"draft": true,
"published_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
configuration: {
nodes: [{id: '<string>', configuration: {}}],
edges: [
{
from_node: '<string>',
to_node: '<string>',
from_field: '<string>',
to_field: '<string>'
}
],
metadata: {}
},
version: '<string>',
application_spec_id: '<string>',
account_id: '<string>',
description: '<string>',
draft: true,
published_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.egp.scale.com/v4/application-variants', 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.egp.scale.com/v4/application-variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'configuration' => [
'nodes' => [
[
'id' => '<string>',
'configuration' => [
]
]
],
'edges' => [
[
'from_node' => '<string>',
'to_node' => '<string>',
'from_field' => '<string>',
'to_field' => '<string>'
]
],
'metadata' => [
]
],
'version' => '<string>',
'application_spec_id' => '<string>',
'account_id' => '<string>',
'description' => '<string>',
'draft' => true,
'published_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/application-variants")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"configuration\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"configuration\": {}\n }\n ],\n \"edges\": [\n {\n \"from_node\": \"<string>\",\n \"to_node\": \"<string>\",\n \"from_field\": \"<string>\",\n \"to_field\": \"<string>\"\n }\n ],\n \"metadata\": {}\n },\n \"version\": \"<string>\",\n \"application_spec_id\": \"<string>\",\n \"account_id\": \"<string>\",\n \"description\": \"<string>\",\n \"draft\": true,\n \"published_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/application-variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"configuration\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"configuration\": {}\n }\n ],\n \"edges\": [\n {\n \"from_node\": \"<string>\",\n \"to_node\": \"<string>\",\n \"from_field\": \"<string>\",\n \"to_field\": \"<string>\"\n }\n ],\n \"metadata\": {}\n },\n \"version\": \"<string>\",\n \"application_spec_id\": \"<string>\",\n \"account_id\": \"<string>\",\n \"description\": \"<string>\",\n \"draft\": true,\n \"published_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"configuration": {
"nodes": [
{
"id": "<string>",
"configuration": {}
}
],
"edges": [
{
"from_node": "<string>",
"to_node": "<string>",
"from_field": "<string>",
"to_field": "<string>"
}
],
"metadata": {}
},
"version": "<string>",
"application_spec_id": "<string>",
"draft": true,
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>"
}{
"errors": [
{
"message": "<string>"
}
],
"sgp_error_code": "APPLICATION_BUILDER_VALIDATION_ERROR"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Application Variant
Description
Creates a application variant
Details
This API can be used to create a application variant. To use this API, review the request schema and pass in all fields that are required to create a application variant.
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
application_variant = client.application_variants.create(
account_id="account_id",
application_spec_id="application_spec_id",
configuration={
"edges": [{
"from_field": "from_field",
"from_node": "from_node",
"to_field": "to_field",
"to_node": "to_node",
}],
"nodes": [{
"id": "id",
"application_node_schema_id": "text_input_schema",
}],
},
name="name",
version="V0",
)
print(application_variant)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
applicationVariant, err := client.ApplicationVariants.New(context.TODO(), sgp.ApplicationVariantNewParams{
Body: sgp.ApplicationVariantNewParamsBodyApplicationVariantV0Request{
AccountID: sgp.F("account_id"),
ApplicationSpecID: sgp.F("application_spec_id"),
Configuration: sgp.F(sgp.ApplicationConfigurationParam{
Edges: sgp.F([]sgp.ApplicationEdgeParam{{
FromField: sgp.F("from_field"),
FromNode: sgp.F("from_node"),
ToField: sgp.F("to_field"),
ToNode: sgp.F("to_node"),
}}),
Nodes: sgp.F([]sgp.ApplicationNodeParam{{
ID: sgp.F("id"),
ApplicationNodeSchemaID: sgp.F(sgp.ApplicationNodeApplicationNodeSchemaIDTextInputSchema),
}}),
}),
Name: sgp.F("name"),
Version: sgp.F(sgp.ApplicationVariantNewParamsBodyApplicationVariantV0RequestVersionV0),
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", applicationVariant)
}curl --request POST \
--url https://api.egp.scale.com/v4/application-variants \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"configuration": {
"nodes": [
{
"id": "<string>",
"configuration": {}
}
],
"edges": [
{
"from_node": "<string>",
"to_node": "<string>",
"from_field": "<string>",
"to_field": "<string>"
}
],
"metadata": {}
},
"version": "<string>",
"application_spec_id": "<string>",
"account_id": "<string>",
"description": "<string>",
"draft": true,
"published_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
configuration: {
nodes: [{id: '<string>', configuration: {}}],
edges: [
{
from_node: '<string>',
to_node: '<string>',
from_field: '<string>',
to_field: '<string>'
}
],
metadata: {}
},
version: '<string>',
application_spec_id: '<string>',
account_id: '<string>',
description: '<string>',
draft: true,
published_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.egp.scale.com/v4/application-variants', 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.egp.scale.com/v4/application-variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'configuration' => [
'nodes' => [
[
'id' => '<string>',
'configuration' => [
]
]
],
'edges' => [
[
'from_node' => '<string>',
'to_node' => '<string>',
'from_field' => '<string>',
'to_field' => '<string>'
]
],
'metadata' => [
]
],
'version' => '<string>',
'application_spec_id' => '<string>',
'account_id' => '<string>',
'description' => '<string>',
'draft' => true,
'published_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/application-variants")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"configuration\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"configuration\": {}\n }\n ],\n \"edges\": [\n {\n \"from_node\": \"<string>\",\n \"to_node\": \"<string>\",\n \"from_field\": \"<string>\",\n \"to_field\": \"<string>\"\n }\n ],\n \"metadata\": {}\n },\n \"version\": \"<string>\",\n \"application_spec_id\": \"<string>\",\n \"account_id\": \"<string>\",\n \"description\": \"<string>\",\n \"draft\": true,\n \"published_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/application-variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"configuration\": {\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"configuration\": {}\n }\n ],\n \"edges\": [\n {\n \"from_node\": \"<string>\",\n \"to_node\": \"<string>\",\n \"from_field\": \"<string>\",\n \"to_field\": \"<string>\"\n }\n ],\n \"metadata\": {}\n },\n \"version\": \"<string>\",\n \"application_spec_id\": \"<string>\",\n \"account_id\": \"<string>\",\n \"description\": \"<string>\",\n \"draft\": true,\n \"published_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"configuration": {
"nodes": [
{
"id": "<string>",
"configuration": {}
}
],
"edges": [
{
"from_node": "<string>",
"to_node": "<string>",
"from_field": "<string>",
"to_field": "<string>"
}
],
"metadata": {}
},
"version": "<string>",
"application_spec_id": "<string>",
"draft": true,
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>"
}{
"errors": [
{
"message": "<string>"
}
],
"sgp_error_code": "APPLICATION_BUILDER_VALIDATION_ERROR"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
- ApplicationVariantV0Request
- ApplicationVariantAgentsServiceRequest
- OfflineApplicationVariantRequest
Show child attributes
Show child attributes
"V0"The ID of the account that owns the given entity.
Optional description of the application variant
Boolean to indicate whether the variant is in draft mode
The date and time that the variant was published.
Response
Successful Response
- ApplicationVariantV0Response
- ApplicationVariantAgentsServiceResponse
- OfflineApplicationVariantResponse
Show child attributes
Show child attributes
"V0"Boolean to indicate whether the variant is in draft mode
The ID of the account that owns the given entity.
The date and time when the entity was created in ISO format.
The date and time when the entity was last updated in ISO format.
Optional description of the application variant
The date and time that the variant was published.
The user who originally created the entity.
The type of identity that created the entity.
user, service_account 
