- list - List opportunities
- create - Create opportunity
- get - Get opportunity
- update - Update opportunity
- delete - Delete opportunity
List opportunities
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\CrmOpportunitiesAllRequest(
serviceId: 'salesforce',
filter: new Components\OpportunitiesFilter(
status: 'Completed',
monetaryAmount: 75000,
),
sort: new Components\OpportunitiesSort(
by: Components\OpportunitiesSortBy::CreatedAt,
direction: Components\SortDirection::Desc,
),
passThrough: [
'search' => 'San Francisco',
],
fields: 'id,updated_at',
);
$responses = $sdk->crm->opportunities->list(
request: $request
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CrmOpportunitiesAllRequest | ✔️ | The request object to use for the request. |
?Operations\CrmOpportunitiesAllResponse
| 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 | */* |
Create opportunity
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Apideck\Unify\Utils;
use Brick\DateTime\LocalDate;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\CrmOpportunitiesAddRequest(
serviceId: 'salesforce',
opportunity: new Components\OpportunityInput(
title: 'New Rocket',
primaryContactId: '12345',
description: 'Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.',
type: 'Existing Customer - Upgrade',
monetaryAmount: 75000,
currency: Components\Currency::Usd,
winProbability: 40,
closeDate: LocalDate::parse('2020-10-30'),
lossReasonId: '12345',
lossReason: 'No budget',
wonReasonId: '12345',
wonReason: 'Best pitch',
pipelineId: '12345',
pipelineStageId: '12345',
sourceId: '12345',
leadId: '12345',
leadSource: 'Website',
contactId: '12345',
contactIds: [
'12345',
],
companyId: '12345',
companyName: 'Copper',
ownerId: '12345',
priority: 'None',
status: 'Open',
statusId: '12345',
tags: [
'New',
],
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
stageLastChangedAt: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
),
);
$response = $sdk->crm->opportunities->create(
request: $request
);
if ($response->createOpportunityResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CrmOpportunitiesAddRequest | ✔️ | The request object to use for the request. |
?Operations\CrmOpportunitiesAddResponse
| 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 opportunity
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\CrmOpportunitiesOneRequest(
id: '<id>',
serviceId: 'salesforce',
fields: 'id,updated_at',
);
$response = $sdk->crm->opportunities->get(
request: $request
);
if ($response->getOpportunityResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CrmOpportunitiesOneRequest | ✔️ | The request object to use for the request. |
?Operations\CrmOpportunitiesOneResponse
| 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 opportunity
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Apideck\Unify\Utils;
use Brick\DateTime\LocalDate;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\CrmOpportunitiesUpdateRequest(
id: '<id>',
serviceId: 'salesforce',
opportunity: new Components\OpportunityInput(
title: 'New Rocket',
primaryContactId: '12345',
description: 'Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.',
type: 'Existing Customer - Upgrade',
monetaryAmount: 75000,
currency: Components\Currency::Usd,
winProbability: 40,
closeDate: LocalDate::parse('2020-10-30'),
lossReasonId: '12345',
lossReason: 'No budget',
wonReasonId: '12345',
wonReason: 'Best pitch',
pipelineId: '12345',
pipelineStageId: '12345',
sourceId: '12345',
leadId: '12345',
leadSource: 'Website',
contactId: '12345',
contactIds: [
'12345',
],
companyId: '12345',
companyName: 'Copper',
ownerId: '12345',
priority: 'None',
status: 'Open',
statusId: '12345',
tags: [
'New',
],
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
stageLastChangedAt: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
),
);
$response = $sdk->crm->opportunities->update(
request: $request
);
if ($response->updateOpportunityResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CrmOpportunitiesUpdateRequest | ✔️ | The request object to use for the request. |
?Operations\CrmOpportunitiesUpdateResponse
| 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 opportunity
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\CrmOpportunitiesDeleteRequest(
id: '<id>',
serviceId: 'salesforce',
);
$response = $sdk->crm->opportunities->delete(
request: $request
);
if ($response->deleteOpportunityResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CrmOpportunitiesDeleteRequest | ✔️ | The request object to use for the request. |
?Operations\CrmOpportunitiesDeleteResponse
| 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 | */* |