transform

# POSTALL,CFO/CreateNewFormDefinition

Arguments

formIdCharacter

formId of the new form definition. Must be unique within the TransForm account

formnameCharacter

descriptive name of the form

formDefinitionJSONCharacter

The JSON definition of the form. You can optionally supply just the form definition commands (i.e. omit meta data).

Returns

resultJSON Object

Returns an object with these properties:

errorboolean

true if there was an error

errorTextstring
resultobject

count of number of records added to the form definitions table

Description

Creates a new TransForm form definition in the account associated with the API key. You can either supply a complete form definition, or just the form definition commands. The form definition commands define the fields on the form. The complete form definition includes the form definition commands, and also defines meta data for the form such as icon, text color, etc. To see an example of the JSON for a complete form definition use the GetFormDefinitionForFormId method.

TIP: You can automatically generate form commands from sample JSON data using the CreateFormCommandsFromSampleJSON method.

### CURL

`CURL --insecure -H "apikey:Your_api_key" -H "accept: application/json" -d "{"""formId""":value_of_formId,"""formname""":value_of_formName,"""formDefinitionJSON""":value_of_formDefinitionJSON}" https://transform.alphasoftware.com/transformAPIVersion1.a5svc/CreateNewFormDefinition`

### Node

```var request = require('request')
var path = 'https://transform.alphasoftware.com/transformAPIVersion1.a5svc/CreateNewFormDefinition';
var data = {"formId": "value_of_formId","formname": "value_of_formName","formDefinitionJSON": "value_of_formDefinitionJSON"};
var dataJSON = JSON.stringify(data)
request.post(
{
url: path,
form: dataJSON},
function(err,httpResponse,body){
if(err) console.log(err)
console.log(body)
}
)```

### Xbasic

```dim apikey as c = "Your_api_key"
dim postdata as c
postdata = <<%txt%
{
"formId": "value_of_formId",
"formname": "value_of_formName",
"formDefinitionJSON": "value_of_formDefinitionJSON"
}

%txt%

dim url as c = "/CreateNewFormDefinition"
dim pr as p
pr = a5dialogHelper_transformAPIQuery(url,postdata,apikey)
if pr.error = .f. then
dim result as c
result = pr.result
else
dim errorText as c
errorText = pr.errorText
end if```