POSTALL/BulkUpdate
Arguments
- apikeystring
Your TransForm API key.
- formdatajsonCharacter
JSON definition of updates to perform. The formdatajson is an array of objects of actions to execute. Each action must have a command. Some actions also require formdata and metadata.
[ { "commands": { "action": "delete", "forminstanceid": "jseouymq_vgnob9dt" } }, { "formdata": { "field1": "Fred", "field2": "Smith" }, "metadata": { "person": "[email protected]", "status": "closed" }, "commands": { "action": "update", "forminstanceId": "jseovih2_zy02059b" } }, { "formdata": { "field1": "John", "field2": "Jones" }, "metadata": { "person": "[email protected]", "status": "open" }, "commands": { "action": "insert", "formid": "form1" } } ]
The JSON format for formdatajson is described below:
- commandsobject
The command to execute.
- actionstring enum
Action to perform. Can be "insert", "update", or "delete".
- Action
- Description
- insert
Create a new instance of a form type.
- update
Update the data in a form instance.
- delete
Delete a form instance.
- forminstanceidstring
The form instance id. Required if action is "delete" or "update".
- formidstring
The form id. Required if action is "insert".
- formdataobject
The form data to set in the form instance. Required if action is "insert" or "update".
- form_fieldstring
The data to insert or update in form_field, where form_field is the field name in the form instance. EG:
"formdata": { "firstname":"Jane", "lastname":"Doe", "address":"123 Main St." }
- metadataobject
Additional form meta data.
Required if action is "insert".
Optional if action is "update".
- personstring
The user to assign the form instance. Must be a valid user in your TransForm account.
- statusstring
The status to assign the form instance. Must be one of the allowed status for your form type. See Statuses for more information.
Returns
- resultJSON Object
Returns an object with these properties:
- errorboolean
true if there was an error
- resultobject array
An array of objects. Number if items in the array match the number of CRUD operations defined in input JSON data.
Description
Perform multiple actions.
Examples
CURL
CURL --insecure --request POST "https://transform.alphasoftware.com/transformAPIVersion1.a5svc/BulkUpdate" \ -header "apikey:Your_api_key" \ -header "content-type: application/json" \ -header "accept: application/json" \ -data "{"""formdatajson""":{}}"
Node
var request = require('request') var path = 'https://transform.alphasoftware.com/transformAPIVersion1.a5svc/BulkUpdate'; var data = {"formdatajson": "{}"}; var dataJSON = JSON.stringify(data) request.post( { headers: {apikey: "Your_api_key"}, 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% { "formdatajson": "{}" } %txt% dim url as c = "/BulkUpdate" 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