create_form

AmplifyUIBuilder.Client.create_form(**kwargs)

Creates a new form for an Amplify app.

See also: AWS API Documentation

Request Syntax

response = client.create_form(
    appId='string',
    clientToken='string',
    environmentName='string',
    formToCreate={
        'cta': {
            'cancel': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            },
            'clear': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            },
            'position': 'top'|'bottom'|'top_and_bottom',
            'submit': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            }
        },
        'dataType': {
            'dataSourceType': 'DataStore'|'Custom',
            'dataTypeName': 'string'
        },
        'fields': {
            'string': {
                'excluded': True|False,
                'inputType': {
                    'defaultChecked': True|False,
                    'defaultCountryCode': 'string',
                    'defaultValue': 'string',
                    'descriptiveText': 'string',
                    'isArray': True|False,
                    'maxValue': ...,
                    'minValue': ...,
                    'name': 'string',
                    'placeholder': 'string',
                    'readOnly': True|False,
                    'required': True|False,
                    'step': ...,
                    'type': 'string',
                    'value': 'string',
                    'valueMappings': {
                        'values': [
                            {
                                'displayValue': {
                                    'value': 'string'
                                },
                                'value': {
                                    'value': 'string'
                                }
                            },
                        ]
                    }
                },
                'label': 'string',
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                },
                'validations': [
                    {
                        'numValues': [
                            123,
                        ],
                        'strValues': [
                            'string',
                        ],
                        'type': 'string',
                        'validationMessage': 'string'
                    },
                ]
            }
        },
        'formActionType': 'create'|'update',
        'name': 'string',
        'schemaVersion': 'string',
        'sectionalElements': {
            'string': {
                'level': 123,
                'orientation': 'string',
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                },
                'text': 'string',
                'type': 'string'
            }
        },
        'style': {
            'horizontalGap': {
                'tokenReference': 'string',
                'value': 'string'
            },
            'outerPadding': {
                'tokenReference': 'string',
                'value': 'string'
            },
            'verticalGap': {
                'tokenReference': 'string',
                'value': 'string'
            }
        },
        'tags': {
            'string': 'string'
        }
    }
)
Parameters
  • appId (string) --

    [REQUIRED]

    The unique ID of the Amplify app to associate with the form.

  • clientToken (string) --

    The unique client token.

    This field is autopopulated if not provided.

  • environmentName (string) --

    [REQUIRED]

    The name of the backend environment that is a part of the Amplify app.

  • formToCreate (dict) --

    [REQUIRED]

    Represents the configuration of the form to create.

    • cta (dict) --

      The FormCTA object that stores the call to action configuration for the form.

      • cancel (dict) --

        Displays a cancel button.

        • children (string) --

          Describes the button's properties.

        • excluded (boolean) --

          Specifies whether the button is visible on the form.

        • position (dict) --

          The position of the button.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: below, fixed, rightOf.

          • below (string) --

            The field position is below the field specified by the string.

          • fixed (string) --

            The field position is fixed and doesn't change in relation to other fields.

          • rightOf (string) --

            The field position is to the right of the field specified by the string.

      • clear (dict) --

        Displays a clear button.

        • children (string) --

          Describes the button's properties.

        • excluded (boolean) --

          Specifies whether the button is visible on the form.

        • position (dict) --

          The position of the button.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: below, fixed, rightOf.

          • below (string) --

            The field position is below the field specified by the string.

          • fixed (string) --

            The field position is fixed and doesn't change in relation to other fields.

          • rightOf (string) --

            The field position is to the right of the field specified by the string.

      • position (string) --

        The position of the button.

      • submit (dict) --

        Displays a submit button.

        • children (string) --

          Describes the button's properties.

        • excluded (boolean) --

          Specifies whether the button is visible on the form.

        • position (dict) --

          The position of the button.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: below, fixed, rightOf.

          • below (string) --

            The field position is below the field specified by the string.

          • fixed (string) --

            The field position is fixed and doesn't change in relation to other fields.

          • rightOf (string) --

            The field position is to the right of the field specified by the string.

    • dataType (dict) -- [REQUIRED]

      The type of data source to use to create the form.

      • dataSourceType (string) -- [REQUIRED]

        The data source type, either an Amplify DataStore model or a custom data type.

      • dataTypeName (string) -- [REQUIRED]

        The unique name of the data type you are using as the data source for the form.

    • fields (dict) -- [REQUIRED]

      The configuration information for the form's fields.

      • (string) --
        • (dict) --

          Describes the configuration information for a field in a table.

          • excluded (boolean) --

            Specifies whether to hide a field.

          • inputType (dict) --

            Describes the configuration for the default input value to display for a field.

            • defaultChecked (boolean) --

              Specifies whether a field has a default value.

            • defaultCountryCode (string) --

              The default country code for a phone number.

            • defaultValue (string) --

              The default value for the field.

            • descriptiveText (string) --

              The text to display to describe the field.

            • isArray (boolean) --

              Specifies whether to render the field as an array. This property is ignored if the dataSourceType for the form is a Data Store.

            • maxValue (float) --

              The maximum value to display for the field.

            • minValue (float) --

              The minimum value to display for the field.

            • name (string) --

              The name of the field.

            • placeholder (string) --

              The text to display as a placeholder for the field.

            • readOnly (boolean) --

              Specifies a read only field.

            • required (boolean) --

              Specifies a field that requires input.

            • step (float) --

              The stepping increment for a numeric value in a field.

            • type (string) -- [REQUIRED]

              The input type for the field.

            • value (string) --

              The value for the field.

            • valueMappings (dict) --

              The information to use to customize the input fields with data at runtime.

              • values (list) -- [REQUIRED]

                The value and display value pairs.

                • (dict) --

                  Associates a complex object with a display value. Use ValueMapping to store how to represent complex objects when they are displayed.

                  • displayValue (dict) --

                    The value to display for the complex object.

                    • value (string) --

                      The value to assign to the input field.

                  • value (dict) -- [REQUIRED]

                    The complex object.

                    • value (string) --

                      The value to assign to the input field.

          • label (string) --

            The label for the field.

          • position (dict) --

            Specifies the field position.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: below, fixed, rightOf.

            • below (string) --

              The field position is below the field specified by the string.

            • fixed (string) --

              The field position is fixed and doesn't change in relation to other fields.

            • rightOf (string) --

              The field position is to the right of the field specified by the string.

          • validations (list) --

            The validations to perform on the value in the field.

            • (dict) --

              Describes the validation configuration for a field.

              • numValues (list) --

                The validation to perform on a number value.

                • (integer) --
              • strValues (list) --

                The validation to perform on a string value.

                • (string) --
              • type (string) -- [REQUIRED]

                The validation to perform on an object type.

              • validationMessage (string) --

                The validation message to display.

    • formActionType (string) -- [REQUIRED]

      Specifies whether to perform a create or update action on the form.

    • name (string) -- [REQUIRED]

      The name of the form.

    • schemaVersion (string) -- [REQUIRED]

      The schema version of the form.

    • sectionalElements (dict) -- [REQUIRED]

      The configuration information for the visual helper elements for the form. These elements are not associated with any data.

      • (string) --
        • (dict) --

          Stores the configuration information for a visual helper element for a form. A sectional element can be a header, a text block, or a divider. These elements are static and not associated with any data.

          • level (integer) --

            Specifies the size of the font for a Heading sectional element. Valid values are 1 | 2 | 3 | 4 | 5 | 6 .

          • orientation (string) --

            Specifies the orientation for a Divider sectional element. Valid values are horizontal or vertical .

          • position (dict) --

            Specifies the position of the text in a field for a Text sectional element.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: below, fixed, rightOf.

            • below (string) --

              The field position is below the field specified by the string.

            • fixed (string) --

              The field position is fixed and doesn't change in relation to other fields.

            • rightOf (string) --

              The field position is to the right of the field specified by the string.

          • text (string) --

            The text for a Text sectional element.

          • type (string) -- [REQUIRED]

            The type of sectional element. Valid values are Heading , Text , and Divider .

    • style (dict) -- [REQUIRED]

      The configuration for the form's style.

      • horizontalGap (dict) --

        The spacing for the horizontal gap.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: tokenReference, value.

        • tokenReference (string) --

          A reference to a design token to use to bind the form's style properties to an existing theme.

        • value (string) --

          The value of the style setting.

      • outerPadding (dict) --

        The size of the outer padding for the form.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: tokenReference, value.

        • tokenReference (string) --

          A reference to a design token to use to bind the form's style properties to an existing theme.

        • value (string) --

          The value of the style setting.

      • verticalGap (dict) --

        The spacing for the vertical gap.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: tokenReference, value.

        • tokenReference (string) --

          A reference to a design token to use to bind the form's style properties to an existing theme.

        • value (string) --

          The value of the style setting.

    • tags (dict) --

      One or more key-value pairs to use when tagging the form data.

      • (string) --
        • (string) --
Return type

dict

Returns

Response Syntax

{
    'entity': {
        'appId': 'string',
        'cta': {
            'cancel': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            },
            'clear': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            },
            'position': 'top'|'bottom'|'top_and_bottom',
            'submit': {
                'children': 'string',
                'excluded': True|False,
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                }
            }
        },
        'dataType': {
            'dataSourceType': 'DataStore'|'Custom',
            'dataTypeName': 'string'
        },
        'environmentName': 'string',
        'fields': {
            'string': {
                'excluded': True|False,
                'inputType': {
                    'defaultChecked': True|False,
                    'defaultCountryCode': 'string',
                    'defaultValue': 'string',
                    'descriptiveText': 'string',
                    'isArray': True|False,
                    'maxValue': ...,
                    'minValue': ...,
                    'name': 'string',
                    'placeholder': 'string',
                    'readOnly': True|False,
                    'required': True|False,
                    'step': ...,
                    'type': 'string',
                    'value': 'string',
                    'valueMappings': {
                        'values': [
                            {
                                'displayValue': {
                                    'value': 'string'
                                },
                                'value': {
                                    'value': 'string'
                                }
                            },
                        ]
                    }
                },
                'label': 'string',
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                },
                'validations': [
                    {
                        'numValues': [
                            123,
                        ],
                        'strValues': [
                            'string',
                        ],
                        'type': 'string',
                        'validationMessage': 'string'
                    },
                ]
            }
        },
        'formActionType': 'create'|'update',
        'id': 'string',
        'name': 'string',
        'schemaVersion': 'string',
        'sectionalElements': {
            'string': {
                'level': 123,
                'orientation': 'string',
                'position': {
                    'below': 'string',
                    'fixed': 'first',
                    'rightOf': 'string'
                },
                'text': 'string',
                'type': 'string'
            }
        },
        'style': {
            'horizontalGap': {
                'tokenReference': 'string',
                'value': 'string'
            },
            'outerPadding': {
                'tokenReference': 'string',
                'value': 'string'
            },
            'verticalGap': {
                'tokenReference': 'string',
                'value': 'string'
            }
        },
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • entity (dict) --

      Describes the configuration of the new form.

      • appId (string) --

        The unique ID of the Amplify app associated with the form.

      • cta (dict) --

        Stores the call to action configuration for the form.

        • cancel (dict) --

          Displays a cancel button.

          • children (string) --

            Describes the button's properties.

          • excluded (boolean) --

            Specifies whether the button is visible on the form.

          • position (dict) --

            The position of the button.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: below, fixed, rightOf. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

            'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
            
            • below (string) --

              The field position is below the field specified by the string.

            • fixed (string) --

              The field position is fixed and doesn't change in relation to other fields.

            • rightOf (string) --

              The field position is to the right of the field specified by the string.

        • clear (dict) --

          Displays a clear button.

          • children (string) --

            Describes the button's properties.

          • excluded (boolean) --

            Specifies whether the button is visible on the form.

          • position (dict) --

            The position of the button.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: below, fixed, rightOf. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

            'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
            
            • below (string) --

              The field position is below the field specified by the string.

            • fixed (string) --

              The field position is fixed and doesn't change in relation to other fields.

            • rightOf (string) --

              The field position is to the right of the field specified by the string.

        • position (string) --

          The position of the button.

        • submit (dict) --

          Displays a submit button.

          • children (string) --

            Describes the button's properties.

          • excluded (boolean) --

            Specifies whether the button is visible on the form.

          • position (dict) --

            The position of the button.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: below, fixed, rightOf. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

            'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
            
            • below (string) --

              The field position is below the field specified by the string.

            • fixed (string) --

              The field position is fixed and doesn't change in relation to other fields.

            • rightOf (string) --

              The field position is to the right of the field specified by the string.

      • dataType (dict) --

        The type of data source to use to create the form.

        • dataSourceType (string) --

          The data source type, either an Amplify DataStore model or a custom data type.

        • dataTypeName (string) --

          The unique name of the data type you are using as the data source for the form.

      • environmentName (string) --

        The name of the backend environment that is a part of the Amplify app.

      • fields (dict) --

        Stores the information about the form's fields.

        • (string) --

          • (dict) --

            Describes the configuration information for a field in a table.

            • excluded (boolean) --

              Specifies whether to hide a field.

            • inputType (dict) --

              Describes the configuration for the default input value to display for a field.

              • defaultChecked (boolean) --

                Specifies whether a field has a default value.

              • defaultCountryCode (string) --

                The default country code for a phone number.

              • defaultValue (string) --

                The default value for the field.

              • descriptiveText (string) --

                The text to display to describe the field.

              • isArray (boolean) --

                Specifies whether to render the field as an array. This property is ignored if the dataSourceType for the form is a Data Store.

              • maxValue (float) --

                The maximum value to display for the field.

              • minValue (float) --

                The minimum value to display for the field.

              • name (string) --

                The name of the field.

              • placeholder (string) --

                The text to display as a placeholder for the field.

              • readOnly (boolean) --

                Specifies a read only field.

              • required (boolean) --

                Specifies a field that requires input.

              • step (float) --

                The stepping increment for a numeric value in a field.

              • type (string) --

                The input type for the field.

              • value (string) --

                The value for the field.

              • valueMappings (dict) --

                The information to use to customize the input fields with data at runtime.

                • values (list) --

                  The value and display value pairs.

                  • (dict) --

                    Associates a complex object with a display value. Use ValueMapping to store how to represent complex objects when they are displayed.

                    • displayValue (dict) --

                      The value to display for the complex object.

                      • value (string) --

                        The value to assign to the input field.

                    • value (dict) --

                      The complex object.

                      • value (string) --

                        The value to assign to the input field.

            • label (string) --

              The label for the field.

            • position (dict) --

              Specifies the field position.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: below, fixed, rightOf. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • below (string) --

                The field position is below the field specified by the string.

              • fixed (string) --

                The field position is fixed and doesn't change in relation to other fields.

              • rightOf (string) --

                The field position is to the right of the field specified by the string.

            • validations (list) --

              The validations to perform on the value in the field.

              • (dict) --

                Describes the validation configuration for a field.

                • numValues (list) --

                  The validation to perform on a number value.

                  • (integer) --
                • strValues (list) --

                  The validation to perform on a string value.

                  • (string) --
                • type (string) --

                  The validation to perform on an object type.

                • validationMessage (string) --

                  The validation message to display.

      • formActionType (string) --

        The operation to perform on the specified form.

      • id (string) --

        The unique ID of the form.

      • name (string) --

        The name of the form.

      • schemaVersion (string) --

        The schema version of the form when it was imported.

      • sectionalElements (dict) --

        Stores the visual helper elements for the form that are not associated with any data.

        • (string) --

          • (dict) --

            Stores the configuration information for a visual helper element for a form. A sectional element can be a header, a text block, or a divider. These elements are static and not associated with any data.

            • level (integer) --

              Specifies the size of the font for a Heading sectional element. Valid values are 1 | 2 | 3 | 4 | 5 | 6 .

            • orientation (string) --

              Specifies the orientation for a Divider sectional element. Valid values are horizontal or vertical .

            • position (dict) --

              Specifies the position of the text in a field for a Text sectional element.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: below, fixed, rightOf. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • below (string) --

                The field position is below the field specified by the string.

              • fixed (string) --

                The field position is fixed and doesn't change in relation to other fields.

              • rightOf (string) --

                The field position is to the right of the field specified by the string.

            • text (string) --

              The text for a Text sectional element.

            • type (string) --

              The type of sectional element. Valid values are Heading , Text , and Divider .

      • style (dict) --

        Stores the configuration for the form's style.

        • horizontalGap (dict) --

          The spacing for the horizontal gap.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: tokenReference, value. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • tokenReference (string) --

            A reference to a design token to use to bind the form's style properties to an existing theme.

          • value (string) --

            The value of the style setting.

        • outerPadding (dict) --

          The size of the outer padding for the form.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: tokenReference, value. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • tokenReference (string) --

            A reference to a design token to use to bind the form's style properties to an existing theme.

          • value (string) --

            The value of the style setting.

        • verticalGap (dict) --

          The spacing for the vertical gap.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: tokenReference, value. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

          'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
          
          • tokenReference (string) --

            A reference to a design token to use to bind the form's style properties to an existing theme.

          • value (string) --

            The value of the style setting.

      • tags (dict) --

        One or more key-value pairs to use when tagging the form.

        • (string) --
          • (string) --

Exceptions

  • AmplifyUIBuilder.Client.exceptions.ServiceQuotaExceededException
  • AmplifyUIBuilder.Client.exceptions.ResourceConflictException
  • AmplifyUIBuilder.Client.exceptions.InternalServerException
  • AmplifyUIBuilder.Client.exceptions.InvalidParameterException