forked from zendesk/zendesk_api_client_php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement HelpCenter Article creation
- Loading branch information
1 parent
4a5e705
commit 66f324c
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
include('../../vendor/autoload.php'); | ||
|
||
use Zendesk\API\HttpClient as ZendeskAPI; | ||
|
||
/** | ||
* Replace the following with your own. | ||
*/ | ||
|
||
$subdomain = "subdomain"; | ||
$username = "email@example.com"; | ||
$token = "6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv"; | ||
|
||
$client = new ZendeskAPI($subdomain); | ||
$client->setAuth('basic', ['username' => $username, 'token' => $token]); | ||
|
||
try { | ||
// Create a new HelpCenter Article | ||
$sectionId = 1; | ||
$article = $client->helpCenter->sections($sectionId)->articles()->create([ | ||
'locale' => 'en-us', | ||
'title' => 'Smartest Fish in the World', | ||
]); | ||
echo "<pre>"; | ||
print_r($article); | ||
echo "</pre>"; | ||
} catch (\Zendesk\API\Exceptions\ApiResponseException $e) { | ||
echo $e->getMessage().'</br>'; | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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