Submitting multiple form values in a single api call

Hii,

I am a beginner in CRM. My doubt is, Can we submit the form values of a form, where the form values will be an array containing many values, with a single api call???

$data2 = array (
	'fields' =>
		[
			[
				[
					'name' => 'email',
					'value' => '333coomonwilliamdizuzass@a.com',
				],
				[
					'name' => 'firstname',
					'value' => '33dizzuu22',
				],
				[
					'name' => 'lastname',
					'value' => '333Grwilluge222',
				],
				[
					'name' => 'grouptestname',
					'value' => '33Grnogroupge',
				],
				[
					'name' => 'roletestname',
					'value' => 'Grge',
				],
				[
					'name' => 'userdatatest',
					'value' => 'Grge',
				],
				[
					'name' => 'roletest',
					'value' => '2',
				],
			],
			[
				[
					'name' => 'email',
					'value' => 'hoorrraayyy@a.com',
				],
				[
					'name' => 'firstname',
					'value' => 'hoorrraayyy',
				],
				[
					'name' => 'lastname',
					'value' => 'hoorrraayyy',
				],
				[
					'name' => 'grouptestname',
					'value' => 'hoorrraayyy',
				],
				[
					'name' => 'roletestname',
					'value' => 'hoorrraayyy',
				],
				[
					'name' => 'userdatatest',
					'value' => 'Grge',
				],
				[
					'name' => 'roletest',
					'value' => '2',
				],
			]
			// 2 =>
			// 	array (
			// 		'name' => 'lastname',
			// 		'value' => 'Gregory',
			// 	),
			// 3 =>
			// 	array (
			// 		'name' => 'grouptestname',
			// 		'value' => '2291 Festival',
			// 	),
			// 4 =>
			// 	array (
			// 		'name' => 'roletestname',
			// 		'value' => 'gguuuujj',
			// 	),
			// 5 =>
			// 	array (
			// 		'name' => 'userdatatest',
			// 		'value' => 'Leadership LeadershipLeadership LeadershipLeadershipLeadershipLeadership LeadershipLeadershipLeadership Leadership',
			// 	),
		],
	'skipValidation' => true,
	'context' =>
		array (
			'hutk' => $hubspotutk,
			'pageUri' => 'url here',
			'pageName' => 'Example page',
		),
);

Can someone help with a solution???

Hey @newMember,

Just to clarify, is there a reason why you’d like to send array values via the HubSpot Form API? Are you looking to pass enumeration fields? If so, as mentioned by Connor on this forum thread, enumeration field should be separated by a semicolon.

The Form data format for HubSpot Form API will have to follow the example formt stated on this documentation: Submit data for a form | Forms API. It is not possible to send array as the form value.

Hi @WendyGoh

My requirement is, generate multiple contact entries in hubspot with a single api call?? Is that possible???

Suppose that it is a shopping site. I am ordering for two products and I need to submit these datas to hubspot as two contacts (for first product one contact, for second product as another contact) in single api call. I hope you understand??

Hi @newMember

Happy to jump in here!

To confirm, our Forms API can not be used to batch create contacts via 1 submission. It can only process 1 submission against a single record via the passed email address.

If you’re looking to batch create contacts, you’re best suited to using our Batch API found here. See below:

POST /crm/v3/objects/contacts/batch/create

Request URL: https://api.hubapi.com/crm/v3/objects/contacts/batch/create?hapikey=YOUR_HUBSPOT_API_KEY

I hope this helps!