This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.php
54 lines (47 loc) · 1.7 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
session_start();
include dirname(__FILE__) . '/library/Actionstep/include.php';
$clientId = "your-client-id";
$clientSecret = "your-client-secret";
$scope = "actions participanttypes participants actiontypes";
$redirectUri = "https://your-redirect-uri";
$userAgent = "your-user-agent";
$apiEndpoint = "fe-api.actionsteplabs.com";
$oauthClient = new Actionstep_Api_oAuthClient($clientId, $clientSecret, $scope, $userAgent, $apiEndpoint);
if (isset($_GET['revoke']) && $_GET['revoke'] == 'T') {
$oauthClient->revokeToken();
header('Location: ' . $redirectUri);
exit;
}
if ($oauthClient->isAuthenticated() === false) {
if (isset($_GET['code'])) {
$oauthClient->convertAuthorizationCodeToAccessToken($_GET['code'], $redirectUri);
header('Location: ' . $redirectUri);
exit;
} else {
$oauthClient->redirectUserToAuthenticationUrl($redirectUri);
exit;
}
}
$response = Actionstep_Api_ResourceHelper::getInstance()->findMany("actions", array(
'filters' => array(
'id_gt'=>10,
'actionType'=>array(
'primaryParticipantType'=>array(
'name_ilike'=>'client'
)
),
),
'include' => array('actionType','actionType.primaryParticipantType'),
'sort' => array('actiontypes'=>'name', 'name'),
'pageSize' => 100
));
if ($response === false) {
die("No records found");
} elseif ($response instanceof Actionstep_Api_Response_Get) {
$actions = $response->actions();
echo "Found " . sizeof($actions) . " matches\n<br>";
foreach ($actions as $action) {
echo $action->id . ": " . $action->name . " (" . $action->actionType()->name . ")\n<br>";
}
}