Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When working with the input type "object" you're required to pass back a "type" and "id" of an existing object or "type" and "dataform", where "dataform" is an associative array of fields from that object's form. For example, the following will create a new company with a new physical address linked to it. 

Code Block
languagebash
$ curl -XPOST /_forms -d '{
	"forms": [{ 
		"form_type": "companies",
		"form_config": { ... }
		"form_data": {
			"company.name" : "Kurt's sample company",
			"company.website": "http://www.kurts-sample-company.com",
			"company.physical_address" : {
				"type": "address",
				"form": {
					"form_type": "addresses",
					"form_config": { ... }
					"form_data": {
						"address.title" : "Kurt's sample address",
						"company.street1": "24323 Kurt's Test Street",
						"company.postcode": "2500",
						...
					}
				}
			},
			...
		}
	}]
}';

 The "dataform" attribute is only supported for object's that are supported by this forms feature.

Multiple Value Support

There are some objects that support multiple values. These are indicated with a 1 in "mutiple_values" attributes from the fields endpoint. For example, companies can support multiple addresses. The following the creates a new physical address and links an existing address with id "1342".

Code Block
languagebash
$ curl -XPOST /_forms -d '{
	"forms": [{ 
		"form_type": "companies",
		"form_config": { ... }
		"form_data": {
			"company.name" : "Kurt's sample company",
			"company.website": "http://www.kurts-sample-company.com",
			"company.physical_address" : [{
				"type": "address",
				"id": 1342
			},{
				"type": "address",
				"form": {
					"form_type": "addresses",
					"form_config": { ... }
					"form_data": {
						"address.title" : "Kurt's sample address",
						"company.street1": "24323 Kurt's Test Street",
						"company.postcode": "2500",
						...
					}
				}
			}],
			...
		}
	}]
}';