API Client
Utility methods

Information about authenticated user

$token = stored_access_token(); // previously obtained access token
$auth = new Authentication\OAuth($token);
$client = new APIClient\Client('https://demo.1crmcloud.com/api.php', $auth);
echo json_encode($client->me(), JSON_PRETTY_PRINT);
1 {
2  "id": "Users:1",
3  "name": null,
4  "first_name": null,
5  "last_name": "Administrator",
6  "role": "user",
7  "groups": [],
8  "email": null
9 }

1CRM server version

$token = stored_access_token(); // previously obtained access token
$auth = new Authentication\OAuth($token);
$client = new APIClient\Client('https://demo.1crmcloud.com/api.php', $auth);
echo json_encode($client->serverVersion(), JSON_PRETTY_PRINT);
1 {
2  "version": "8.5.0",
3  "authenticated": true,
4  "products": [
5  "enterprise"
6  ]
7 }

This method can be called without authentication:

$client = new APIClient\Client('https://demo.1crmcloud.com/api.php');
echo json_encode($client->serverVersion(), JSON_PRETTY_PRINT);
1 {
2  "version": "8.5.0",
3  "authenticated": false,
4  "products": [
5  "enterprise"
6  ]
7 }

Get 1CRM API server public key:

$token = stored_access_token(); // previously obtained access token
$auth = new Authentication\OAuth($token);
$client = new APIClient\Client('https://demo.1crmcloud.com/api.php', $auth);
echo $client->serverKey();
1 -----BEGIN PUBLIC KEY-----
2 MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4KcMj6As8IE5VvgE8IGm
3 X+nQC4smrw5BG3QzJAf735RFkHXnGb1CbeE1WHLCol8Hm+u2VphHRLjNW8x7/T+S
4 QyiBsGY0RZl1fdRG5MKeAPH6z2zPs84p45h1pyitzMHdr0g8fXiNc6qSJ6cCC188
5 oqx/owTFPdBhciie7avn6JX6HcT9FXdO8GLW4hDQWM2GPMrw9JwJR06zRKI7dyur
6 RBRAvcX1daUb/w6/N+n+f12iPaKiizOUPTW8Pp3a19NnW+Cg83WhWHF1fcoM6aJ2
7 2zwJwi1Mg4HEbU7hT5VE5Qc57q0akboLZYDOuOI0g3q13HjJwhxl8OslCP6ukbIQ
8 NNcxFukflpaGjffPYqvCahEc5UW4woaacdFidP9D13UhGS5tMxS2iOzJxmzgL2cG
9 bgDocuTFfIxKP3H0EdTeJApGBGNozN0U8s8WqXCgKtlHXGgwJx5VEgdO7kKkk9R4
10 /XMxheojLObYOS1UygX0kHbW/XyV+zAztjHN4Y9RRVkE06IDHwqR6EqyuRuiCLJY
11 OUFCO0O8cz/QjvzdpfmF2mb9E6Be6ov7jr5l7i6o2b5EkrcvpD41NZwGArscJu3P
12 3LEL94V+SQ34ck1Vkdg0Y1LUkBrvEjeh9wgBTOQpVmvZfnjtmxbVLFXRFUfqVQ3X
13 4LsEpFI2Bc9fZIsrnJ8nr8sCAwEAAQ==
14 -----END PUBLIC KEY-----

This method does not require authentication:

$client = new APIClient\Client('https://demo.1crmcloud.com/api.php');
echo $client->serverKey();
1 -----BEGIN PUBLIC KEY-----
2 MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4KcMj6As8IE5VvgE8IGm
3 X+nQC4smrw5BG3QzJAf735RFkHXnGb1CbeE1WHLCol8Hm+u2VphHRLjNW8x7/T+S
4 QyiBsGY0RZl1fdRG5MKeAPH6z2zPs84p45h1pyitzMHdr0g8fXiNc6qSJ6cCC188
5 oqx/owTFPdBhciie7avn6JX6HcT9FXdO8GLW4hDQWM2GPMrw9JwJR06zRKI7dyur
6 RBRAvcX1daUb/w6/N+n+f12iPaKiizOUPTW8Pp3a19NnW+Cg83WhWHF1fcoM6aJ2
7 2zwJwi1Mg4HEbU7hT5VE5Qc57q0akboLZYDOuOI0g3q13HjJwhxl8OslCP6ukbIQ
8 NNcxFukflpaGjffPYqvCahEc5UW4woaacdFidP9D13UhGS5tMxS2iOzJxmzgL2cG
9 bgDocuTFfIxKP3H0EdTeJApGBGNozN0U8s8WqXCgKtlHXGgwJx5VEgdO7kKkk9R4
10 /XMxheojLObYOS1UygX0kHbW/XyV+zAztjHN4Y9RRVkE06IDHwqR6EqyuRuiCLJY
11 OUFCO0O8cz/QjvzdpfmF2mb9E6Be6ov7jr5l7i6o2b5EkrcvpD41NZwGArscJu3P
12 3LEL94V+SQ34ck1Vkdg0Y1LUkBrvEjeh9wgBTOQpVmvZfnjtmxbVLFXRFUfqVQ3X
13 4LsEpFI2Bc9fZIsrnJ8nr8sCAwEAAQ==
14 -----END PUBLIC KEY-----