Created
November 5, 2014 16:17
-
-
Save tstachl/715fc3ed0494101d9a81 to your computer and use it in GitHub Desktop.
Assigning a user to a case written in PHP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = json_encode(array( | |
'_links' => array( | |
'assigned_user' => array( | |
'href' => '/api/v2/users/16096734', | |
'class' => 'user' | |
) | |
) | |
)); | |
echo($json); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://site.desk.com/api/v2/cases/3012'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH"); | |
curl_setopt($ch, CURLOPT_USERPWD, "[email protected]:SuperSecretPassword"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($json)) | |
); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
echo($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment