Versions Compared

Key

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

...

Code Block
<?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> array(
				"LatLng" => 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> array(
				"LatLng" => 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",
        		"Name" => "No People Moving",
        		"VDec" => 1
  			),
	  		array(
  				"IDCF" => "fcaba48d-4aae-478c-a275-0d0b2474ce75",
        		"Name" => "Lift Origin",
        		"VDec" => 1
  			),
	  		array(
  				"IDCF" => "64d9d941-76a2-4bed-ba39-e224eb9a76e7",
        		"Name" => "Stairs Origine",
        		"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;

?>