(crm->users)
Create user
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity($security)->build();
$request = new Operations\CrmUsersAddRequest(
user: new Components\UserInput(
emails: [
new Components\Email(
email: '[email protected]',
id: '123',
type: Components\EmailType::Primary,
),
],
addresses: [
new Components\Address(
id: '123',
type: Components\Type::Primary,
string: '25 Spring Street, Blackburn, VIC 3130',
name: 'HQ US',
line1: 'Main street',
line2: 'apt #',
line3: 'Suite #',
line4: 'delivery instructions',
streetNumber: '25',
city: 'San Francisco',
state: 'CA',
postalCode: '94104',
country: 'US',
latitude: '40.759211',
longitude: '-73.984638',
county: 'Santa Clara',
contactName: 'Elon Musk',
salutation: 'Mr',
phoneNumber: '111-111-1111',
fax: '122-111-1111',
email: '[email protected]',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
],
phoneNumbers: [
new Components\PhoneNumber(
number: '111-111-1111',
id: '12345',
countryCode: '1',
areaCode: '323',
extension: '105',
type: Components\PhoneNumberType::Primary,
),
],
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
parentId: '54321',
username: 'masterofcoin',
firstName: 'Elon',
lastName: 'Musk',
title: 'CEO',
division: 'Europe',
companyName: 'SpaceX',
employeeNumber: '123456-AB',
description: 'A description',
image: 'https://logo.clearbit.com/spacex.com?s=128',
language: 'EN',
status: 'active',
password: 'supersecretpassword',
),
serviceId: 'salesforce',
);
$response = $sdk->crm->users->create(
request: $request
);
if ($response->createUserResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CrmUsersAddRequest | ✔️ | The request object to use for the request. |
?Operations\CrmUsersAddResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List users
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity($security)->build();
$request = new Operations\CrmUsersAllRequest(
serviceId: 'salesforce',
passThrough: [
'search' => 'San Francisco',
],
fields: 'id,updated_at',
);
$responses = $sdk->crm->users->list(
request: $request
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CrmUsersAllRequest | ✔️ | The request object to use for the request. |
?Operations\CrmUsersAllResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Delete user
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity($security)->build();
$request = new Operations\CrmUsersDeleteRequest(
id: '<id>',
serviceId: 'salesforce',
);
$response = $sdk->crm->users->delete(
request: $request
);
if ($response->deleteUserResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CrmUsersDeleteRequest | ✔️ | The request object to use for the request. |
?Operations\CrmUsersDeleteResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get user
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity($security)->build();
$request = new Operations\CrmUsersOneRequest(
id: '<id>',
serviceId: 'salesforce',
fields: 'id,updated_at',
);
$response = $sdk->crm->users->get(
request: $request
);
if ($response->getUserResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CrmUsersOneRequest | ✔️ | The request object to use for the request. |
?Operations\CrmUsersOneResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update user
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity($security)->build();
$request = new Operations\CrmUsersUpdateRequest(
id: '<id>',
user: new Components\UserInput(
emails: [
new Components\Email(
email: '[email protected]',
id: '123',
type: Components\EmailType::Primary,
),
],
addresses: [
new Components\Address(
id: '123',
type: Components\Type::Primary,
string: '25 Spring Street, Blackburn, VIC 3130',
name: 'HQ US',
line1: 'Main street',
line2: 'apt #',
line3: 'Suite #',
line4: 'delivery instructions',
streetNumber: '25',
city: 'San Francisco',
state: 'CA',
postalCode: '94104',
country: 'US',
latitude: '40.759211',
longitude: '-73.984638',
county: 'Santa Clara',
contactName: 'Elon Musk',
salutation: 'Mr',
phoneNumber: '111-111-1111',
fax: '122-111-1111',
email: '[email protected]',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
],
phoneNumbers: [
new Components\PhoneNumber(
number: '111-111-1111',
id: '12345',
countryCode: '1',
areaCode: '323',
extension: '105',
type: Components\PhoneNumberType::Primary,
),
],
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
parentId: '54321',
username: 'masterofcoin',
firstName: 'Elon',
lastName: 'Musk',
title: 'CEO',
division: 'Europe',
companyName: 'SpaceX',
employeeNumber: '123456-AB',
description: 'A description',
image: 'https://logo.clearbit.com/spacex.com?s=128',
language: 'EN',
status: 'active',
password: 'supersecretpassword',
),
serviceId: 'salesforce',
);
$response = $sdk->crm->users->update(
request: $request
);
if ($response->updateUserResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CrmUsersUpdateRequest | ✔️ | The request object to use for the request. |
?Operations\CrmUsersUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |