Create Custom Form
POST {{apiPath}}/environments/{{envID}}/forms
The POST /environments/{environmentId}/forms
operation creates a new forms resource in the environment identified by its ID in the request URL. This sample shows a basic form that can be customized to include additional form fields.
The components.fields.label
attribute is a nested JSON structure. This structure is designed to store a series of text and translatable keys (as well as rich text). In this example, the label includes an object with a type
key and value of i18n
with a key called fields.user.email.label
and a default translation of Email Address
. Likewise, the submit button has a key of button.text
with a default translation of Submit
.
See Forms for complete descriptions.
Property | Type | Required? |
---|---|---|
created | Date | N/A |
category | String | Required |
cols | Integer | Optional |
components | Object | Required |
description | String | Optional |
environment.id | String | N/A |
fieldTypes | Object | Optional |
id | String | N/A |
languageBundle | Object | Optional |
markOptional | Boolean | Required |
markRequired | Boolean | Required |
modified | Date | N/A |
name | String | Required |
translationMethod | String | Optional |
Request Body
{"name"=>"Custom-Form_{{$timestamp}}", "description"=>"Test Description - created via CREATE Custom Form request", "category"=>"CUSTOM", "components"=>{"fields"=>[{"type"=>"TEXT", "position"=>{"row"=>0, "col"=>0}, "key"=>"field", "label"=>"[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"},{\"type\":\"i18n\",\"key\":\"fields.user.email.label\",\"defaultTranslation\":\"Email Address\",\"inline\":true,\"children\":[{\"text\":\"\"}]},{\"text\":\"\"}]}]", "required"=>true, "validation"=>{"type"=>"NONE", "regex"=>"", "errorMessage"=>""}, "attributeDisabled"=>false}, {"type"=>"SOCIAL_LOGIN_BUTTON", "position"=>{"row"=>1, "col"=>0}, "key"=>"social-login-button-field", "label"=>"Sign in with Google", "styles"=>{"width"=>100, "alignment"=>"CENTER", "enabled"=>false}, "idpType"=>"GOOGLE", "idpName"=>"Google", "idpId"=>"{{providerID}}", "idpEnabled"=>true}, {"type"=>"SUBMIT_BUTTON", "position"=>{"row"=>2, "col"=>0}, "label"=>"[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"},{\"type\":\"i18n\",\"key\":\"button.text\",\"defaultTranslation\":\"Submit\",\"inline\":true,\"children\":[{\"text\":\"\"}]},{\"text\":\"\"}]}]"}]}, "cols"=>4, "markOptional"=>true, "markRequired"=>false, "translationMethod"=>"TRANSLATE", "fieldTypes"=>["SUBMIT_BUTTON", "TEXT"], "languageBundle"=>{"fields.user.email.label"=>"Email Address", "button.text"=>"Submit"}}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/forms/05e406b0-156a-45d4-ab5f-6cc612057643"}},"id":"05e406b0-156a-45d4-ab5f-6cc612057643","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"Custom-Form_1723747796","description":"Test Description - created via CREATE Custom Form request","category":"CUSTOM","components":{"fields":[{"type":"TEXT","position":{"row":0,"col":0},"key":"field","label":"[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"},{\"type\":\"i18n\",\"key\":\"fields.user.email.label\",\"defaultTranslation\":\"Email Address\",\"inline\":true,\"children\":[{\"text\":\"\"}]},{\"text\":\"\"}]}]","required":true,"validation":{"type":"NONE","regex":"","errorMessage":""},"otherOptionEnabled":false,"otherOptionAttributeDisabled":false,"attributeDisabled":false},{"type":"SOCIAL_LOGIN_BUTTON","position":{"row":1,"col":0},"key":"social-login-button-field","label":"Sign in with Google","styles":{"width":100,"alignment":"CENTER","enabled":false},"idpType":"GOOGLE","idpName":"Google","idpId":"a46c0613-7e78-462f-aa2c-6cc47af9e61b","idpEnabled":true},{"type":"SUBMIT_BUTTON","position":{"row":2,"col":0},"label":"[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"},{\"type\":\"i18n\",\"key\":\"button.text\",\"defaultTranslation\":\"Submit\",\"inline\":true,\"children\":[{\"text\":\"\"}]},{\"text\":\"\"}]}]"}]},"cols":4,"markOptional":true,"markRequired":false,"translationMethod":"TRANSLATE","fieldTypes":["TEXT","SUBMIT_BUTTON","SOCIAL_LOGIN_BUTTON"],"languageBundle":{"fields.user.email.label":"Email Address","button.text":"Submit"},"created":"2024-08-15T18:49:55.948Z","modified":"2024-08-15T18:49:55.948Z"}