Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Here is a sample PHP code used to create a Job in Crittah and set cutom fields for the job.

<?php
$url = 'https://xxxxxx.crittah.com/ws/apiv2/json/jobs';
$method = 'POST';
$headers = array("Content-Type: application/json", 
					"API-AppID: 5e2a45af-855a-42a0-bdc7-2e34e65804cf", 
					"Api-Username: XXXXXXXXX", 
					"API-Password: XXXXXXXXX");
$data = array(
  "IDSite" => "20058233-7388-418b-9193-6b57e28604f9",
  "IDJobType" => "72318033-b541-4b07-baf2-158ff8a2e246",
  "IDContact" => "418c2fdb-ef0f-419e-add8-42a753cbd6db",
  "DueDate" => "2014-11-04T23:07:00Z",
  "Address" => array(
        "AddressLine1" => "1 Keda Circuit",
        "AddressLine2" => null,
        "City" => "NORTH RICHMOND",
        "State" => "NSW",
        "Country" => "Australia",
        "PostCode" => "2754",
        "LocRef" =>array(
			"Lat" => -33.585071,
			"Lng" => 150.716795
        )
     ),
  "AddressDelivery" => array(
        "AddressLine1" => "200 George Street",
        "AddressLine2" => null,
        "City" => "SYDNEY",
        "State" => "NSW",
        "Country" => "Australia",
        "PostCode" => "2000",
        "LocRef" =>array(
			"Lat" => -33.862736,
			"Lng" => 151.207795
        )
     ),
  "CustFields" => array(
  		"CF" => array(
	  		array(
  				"IDCF" => "9540ddb2-2a52-4128-831d-d4d9886f4829",
        		"Name" => "Move type",
        		"VID" => "d26be884-9ac2-458a-b3db-12576678016f"
  			),
	  		array(
  				"IDCF" => "26ffa3ee-7cc6-4d2a-bc5f-6aa314c1a2bd",
        		"VDec" => 1
  			),
	  		array(
  				"IDCF" => "fcaba48d-4aae-478c-a275-0d0b2474ce75",
        		"VDec" => 1
  			),
	  		array(
  				"IDCF" => "64d9d941-76a2-4bed-ba39-e224eb9a76e7",
        		"VDec" => 0
  			)
  		)
	),
  "Notes" => array(
		array(
			"IDNoteType" => "22fcd267-1958-4a27-8e9c-09139ea3f8a8",
			"NoteInfo" => "this is a note"
		)
	)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
echo $response;

?>
  • No labels