Skip to main content
Update a field in a model in the Application
curl --request PATCH \
  --url https://sapi.withsutro.com/applications/{applicationId}/models/{modelId}/fields/{fieldId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-sutro-api-client: <api-key>' \
  --data '
{
  "name": "<string>",
  "relationshipOwner": true,
  "min": 123,
  "max": 123,
  "computed": "<string>",
  "defaultValue": "<unknown>",
  "enum": [
    "<string>"
  ]
}
'
{
  "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

Authorization
string
header
required

Builder authentication and authorization

x-sutro-api-client
string
header
required

A unique identifier for the API Client making a request

Path Parameters

applicationId
string<uuid>
required
modelId
string
required
Pattern: ^urn:sutro:model:.*$
fieldId
string
required
Pattern: ^urn:sutro:edge:.*$

Body

application/json
name
string

The name of the field, e.g. user

relationshipOwner
boolean

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.

min
number

The minimum number of values that can be stored in this field

max
number | null

The maximum number of values that can be stored in this field

to
enum<string>

The type of the field's value

Available options:
p_TEXT,
p_IMAGE,
p_BOOLEAN,
p_NUMBER,
p_DATE,
p_DATE_TIME,
p_TIME,
p_ADDRESS,
p_PHONE_NUMBER,
p_CURRENCY_AMOUNT,
p_LINK,
p_VIDEO,
p_STAR_RATING,
p_FILE
accessControl
object
computed
string

Optional computed expression for the field

defaultValue
any

The default value for the field

enum
(string | number | boolean)[]

If set, the field is an enum and can only take on these values

Response

The updated application

An application

id
string<uuid>
required

Unique identifier for the application

scode
SCode representation of an Application · object
required

The application's SCode definition

projectId
string<uuid>
required

The project this application belongs to

status
object
required
isActive
boolean
required

Whether the application is currently active for billing/runtime purposes

name
string

The name of the application

serverVersion
string

The current saved server version (semver)

lastPublishedAt
string<date-time>

When the application was last published

lastUnpublishedAt
string<date-time>

When the application was last unpublished