curl --request POST \
--url https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-sutro-api-client: <api-key>' \
--data '
{
"id": "<string>",
"name": "<string>",
"relationshipOwner": true,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": [
"<string>"
]
}
'import requests
url = "https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields"
payload = {
"id": "<string>",
"name": "<string>",
"relationshipOwner": True,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"x-sutro-api-client": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-sutro-api-client': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '<string>',
name: '<string>',
relationshipOwner: true,
min: 123,
max: 123,
to: '<string>',
accessControl: {},
computed: '<string>',
defaultValue: '<unknown>',
enum: ['<string>']
})
};
fetch('https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields', 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://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields",
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([
'id' => '<string>',
'name' => '<string>',
'relationshipOwner' => true,
'min' => 123,
'max' => 123,
'to' => '<string>',
'accessControl' => [
],
'computed' => '<string>',
'defaultValue' => '<unknown>',
'enum' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-sutro-api-client: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-sutro-api-client", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields")
.header("Authorization", "Bearer <token>")
.header("x-sutro-api-client", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-sutro-api-client"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scode": {
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
],
"appId": "<string>",
"version": "<string>",
"appOverview": {
"name": "<string>",
"jobToBeDone": "<string>",
"unsupportedUserJourneys": [
{
"name": "<string>",
"description": "<string>",
"reason": "<string>",
"steps": [
"<string>"
]
}
],
"draftUserJourneys": [
{
"name": "<string>",
"outcome": "<string>",
"steps": [
"<string>"
]
}
]
},
"appDescription": "<string>",
"appDraft": {
"sitemap": {
"nodes": [
{
"id": "<string>",
"route": "<string>",
"content": [
{
"title": "<string>",
"description": "<string>"
}
]
}
],
"edges": [
{
"from": "<string>",
"to": "<string>",
"type": "<string>"
}
]
},
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
]
},
"domainModel": {
"models": [
{
"name": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>"
}
],
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
],
"isUserModel": true
}
]
},
"actions": [
{
"id": "<string>",
"effects": [
{
"actionEffectId": "<string>",
"effect": "<string>",
"params": {},
"bindParams": {},
"next": "<string>",
"onError": {
"nextId": "<string>",
"continueOriginalFlow": true
}
}
],
"startEffectId": "<string>",
"bindReturnValue": "<string>",
"onError": {
"nextId": "<string>",
"continueOriginalFlow": true
},
"referenceRequirements": [
"<string>"
]
}
],
"triggers": [
{
"trigger": {
"id": "<string>",
"type": "<unknown>",
"eventName": "<string>",
"payload": {}
},
"actionId": "<string>",
"initialState": {},
"validation": [
"<string>"
],
"isPublic": true,
"referenceRequirements": [
"<string>"
]
}
],
"userModelId": "<string>",
"models": [
{
"id": "<string>",
"name": "<string>",
"fields": [
{
"id": "<string>",
"name": "<string>",
"relationshipOwner": true,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {
"rules": [
{
"criteria": "<string>"
}
]
},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": [
"<string>"
]
}
],
"accessControl": {
"rules": [
{
"criteria": "<string>"
}
]
},
"referenceRequirements": [
"<string>"
]
}
],
"personas": [
{
"name": "<string>"
}
]
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": {
"jobs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"implementationJobId": "<string>",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"errorMessage": "<string>",
"errorStack": "<string>",
"startedAt": "<string>",
"completedAt": "<string>"
}
]
},
"isActive": true,
"name": "<string>",
"serverVersion": "<string>",
"lastPublishedAt": "2023-11-07T05:31:56Z",
"lastUnpublishedAt": "2023-11-07T05:31:56Z"
}Add a field to a model in the Application
curl --request POST \
--url https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-sutro-api-client: <api-key>' \
--data '
{
"id": "<string>",
"name": "<string>",
"relationshipOwner": true,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": [
"<string>"
]
}
'import requests
url = "https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields"
payload = {
"id": "<string>",
"name": "<string>",
"relationshipOwner": True,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"x-sutro-api-client": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-sutro-api-client': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '<string>',
name: '<string>',
relationshipOwner: true,
min: 123,
max: 123,
to: '<string>',
accessControl: {},
computed: '<string>',
defaultValue: '<unknown>',
enum: ['<string>']
})
};
fetch('https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields', 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://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields",
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([
'id' => '<string>',
'name' => '<string>',
'relationshipOwner' => true,
'min' => 123,
'max' => 123,
'to' => '<string>',
'accessControl' => [
],
'computed' => '<string>',
'defaultValue' => '<unknown>',
'enum' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-sutro-api-client: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-sutro-api-client", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields")
.header("Authorization", "Bearer <token>")
.header("x-sutro-api-client", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-sutro-api-client"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"relationshipOwner\": true,\n \"min\": 123,\n \"max\": 123,\n \"to\": \"<string>\",\n \"accessControl\": {},\n \"computed\": \"<string>\",\n \"defaultValue\": \"<unknown>\",\n \"enum\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scode": {
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
],
"appId": "<string>",
"version": "<string>",
"appOverview": {
"name": "<string>",
"jobToBeDone": "<string>",
"unsupportedUserJourneys": [
{
"name": "<string>",
"description": "<string>",
"reason": "<string>",
"steps": [
"<string>"
]
}
],
"draftUserJourneys": [
{
"name": "<string>",
"outcome": "<string>",
"steps": [
"<string>"
]
}
]
},
"appDescription": "<string>",
"appDraft": {
"sitemap": {
"nodes": [
{
"id": "<string>",
"route": "<string>",
"content": [
{
"title": "<string>",
"description": "<string>"
}
]
}
],
"edges": [
{
"from": "<string>",
"to": "<string>",
"type": "<string>"
}
]
},
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
]
},
"domainModel": {
"models": [
{
"name": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>"
}
],
"requirements": [
{
"id": "<string>",
"description": "<string>",
"parentId": "<string>"
}
],
"isUserModel": true
}
]
},
"actions": [
{
"id": "<string>",
"effects": [
{
"actionEffectId": "<string>",
"effect": "<string>",
"params": {},
"bindParams": {},
"next": "<string>",
"onError": {
"nextId": "<string>",
"continueOriginalFlow": true
}
}
],
"startEffectId": "<string>",
"bindReturnValue": "<string>",
"onError": {
"nextId": "<string>",
"continueOriginalFlow": true
},
"referenceRequirements": [
"<string>"
]
}
],
"triggers": [
{
"trigger": {
"id": "<string>",
"type": "<unknown>",
"eventName": "<string>",
"payload": {}
},
"actionId": "<string>",
"initialState": {},
"validation": [
"<string>"
],
"isPublic": true,
"referenceRequirements": [
"<string>"
]
}
],
"userModelId": "<string>",
"models": [
{
"id": "<string>",
"name": "<string>",
"fields": [
{
"id": "<string>",
"name": "<string>",
"relationshipOwner": true,
"min": 123,
"max": 123,
"to": "<string>",
"accessControl": {
"rules": [
{
"criteria": "<string>"
}
]
},
"computed": "<string>",
"defaultValue": "<unknown>",
"enum": [
"<string>"
]
}
],
"accessControl": {
"rules": [
{
"criteria": "<string>"
}
]
},
"referenceRequirements": [
"<string>"
]
}
],
"personas": [
{
"name": "<string>"
}
]
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": {
"jobs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"implementationJobId": "<string>",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"errorMessage": "<string>",
"errorStack": "<string>",
"startedAt": "<string>",
"completedAt": "<string>"
}
]
},
"isActive": true,
"name": "<string>",
"serverVersion": "<string>",
"lastPublishedAt": "2023-11-07T05:31:56Z",
"lastUnpublishedAt": "2023-11-07T05:31:56Z"
}Authorizations
Builder authentication and authorization
A unique identifier for the API Client making a request
Path Parameters
^urn:sutro:model:.*$Body
The unique identifier for an edge, e.g. urn:sutro:edge:owners. Must start with "urn:sutro:edge:".
^urn:sutro:edge:The name of the field, e.g. user
If true, this field's parent model is the owner of the relationship - basically always except if this is a 'belongs to' pointer. Every relationship needs to point to another model's field.
The minimum number of values that can be stored in this field
The maximum number of values that can be stored in this field
The type of the field's value
^urn:sutro:model:Optional computed expression for the field
The default value for the field
If set, the field is an enum and can only take on these values
Response
The updated application
An application
Unique identifier for the application
The application's SCode definition
Show child attributes
Show child attributes
The project this application belongs to
Show child attributes
Show child attributes
Whether the application is currently active for billing/runtime purposes
The name of the application
The current saved server version (semver)
When the application was last published
When the application was last unpublished
Was this page helpful?