- list - List Purchase Orders
- create - Create Purchase Order
- get - Get Purchase Order
- update - Update Purchase Order
- delete - Delete Purchase Order
List Purchase Orders
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;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\AccountingPurchaseOrdersAllRequest(
serviceId: 'salesforce',
companyId: '12345',
passThrough: [
'search' => 'San Francisco',
],
filter: new Components\PurchaseOrdersFilter(
updatedSince: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
supplierId: '1234',
),
sort: new Components\PurchaseOrdersSort(
by: Components\PurchaseOrdersSortBy::UpdatedAt,
direction: Components\SortDirection::Desc,
),
);
$responses = $sdk->accounting->purchaseOrders->list(
request: $request
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\AccountingPurchaseOrdersAllRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingPurchaseOrdersAllResponse
| 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 Purchase Order
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Brick\DateTime\LocalDate;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\AccountingPurchaseOrdersAddRequest(
serviceId: 'salesforce',
companyId: '12345',
purchaseOrder: new Components\PurchaseOrderInput(
poNumber: '90000117',
reference: '123456',
supplier: new Components\LinkedSupplierInput(
id: '12345',
displayName: 'Windsurf Shop',
address: 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: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
),
subsidiaryId: '12345',
companyId: '12345',
status: Components\PurchaseOrderStatus::Open,
issuedDate: LocalDate::parse('2020-09-30'),
deliveryDate: LocalDate::parse('2020-09-30'),
expectedArrivalDate: LocalDate::parse('2020-09-30'),
currency: Components\Currency::Usd,
currencyRate: 0.69,
subTotal: 27500,
totalTax: 2500,
total: 27500,
taxInclusive: true,
lineItems: [
new Components\InvoiceLineItemInput(
id: '12345',
rowId: '12345',
code: '120-C',
lineNumber: 1,
description: 'Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.',
type: Components\InvoiceLineItemType::SalesItem,
taxAmount: 27500,
totalAmount: 27500,
quantity: 1,
unitPrice: 27500.5,
unitOfMeasure: 'pc.',
discountPercentage: 0.01,
discountAmount: 19.99,
locationId: '12345',
departmentId: '12345',
item: new Components\LinkedInvoiceItem(
id: '12344',
code: '120-C',
name: 'Model Y',
),
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
trackingCategories: [
new Components\LinkedTrackingCategory(
id: '123456',
name: 'New York',
),
],
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
rowVersion: '1-12345',
),
new Components\InvoiceLineItemInput(
id: '12345',
rowId: '12345',
code: '120-C',
lineNumber: 1,
description: 'Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.',
type: Components\InvoiceLineItemType::SalesItem,
taxAmount: 27500,
totalAmount: 27500,
quantity: 1,
unitPrice: 27500.5,
unitOfMeasure: 'pc.',
discountPercentage: 0.01,
discountAmount: 19.99,
locationId: '12345',
departmentId: '12345',
item: new Components\LinkedInvoiceItem(
id: '12344',
code: '120-C',
name: 'Model Y',
),
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
trackingCategories: [
new Components\LinkedTrackingCategory(
id: '123456',
name: 'New York',
),
],
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
rowVersion: '1-12345',
),
new Components\InvoiceLineItemInput(
id: '12345',
rowId: '12345',
code: '120-C',
lineNumber: 1,
description: 'Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.',
type: Components\InvoiceLineItemType::SalesItem,
taxAmount: 27500,
totalAmount: 27500,
quantity: 1,
unitPrice: 27500.5,
unitOfMeasure: 'pc.',
discountPercentage: 0.01,
discountAmount: 19.99,
locationId: '12345',
departmentId: '12345',
item: new Components\LinkedInvoiceItem(
id: '12344',
code: '120-C',
name: 'Model Y',
),
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
trackingCategories: [
new Components\LinkedTrackingCategory(
id: '123456',
name: 'New York',
),
],
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
rowVersion: '1-12345',
),
],
shippingAddress: 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: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
templateId: '123456',
discountPercentage: 5.5,
bankAccount: new Components\BankAccount(
bankName: 'Monzo',
accountNumber: '123465',
accountName: 'SPACEX LLC',
accountType: Components\AccountType::CreditCard,
iban: 'CH2989144532982975332',
bic: 'AUDSCHGGXXX',
routingNumber: '012345678',
bsbNumber: '062-001',
branchIdentifier: '001',
bankCode: 'BNH',
currency: Components\Currency::Usd,
),
accountingByRow: false,
dueDate: LocalDate::parse('2020-10-30'),
paymentMethod: 'cash',
taxCode: '1234',
channel: 'email',
memo: 'Thank you for the partnership and have a great day!',
trackingCategories: [
new Components\LinkedTrackingCategory(
id: '123456',
name: 'New York',
),
],
customFields: [
new Components\CustomField1(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: 'Uses Salesforce and Marketo',
),
],
rowVersion: '1-12345',
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\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\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->accounting->purchaseOrders->create(
request: $request
);
if ($response->createPurchaseOrderResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\AccountingPurchaseOrdersAddRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingPurchaseOrdersAddResponse
| 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 Purchase Order
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\AccountingPurchaseOrdersOneRequest(
id: '<id>',
serviceId: 'salesforce',
companyId: '12345',
);
$response = $sdk->accounting->purchaseOrders->get(
request: $request
);
if ($response->getPurchaseOrderResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\AccountingPurchaseOrdersOneRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingPurchaseOrdersOneResponse
| 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 Purchase Order
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Brick\DateTime\LocalDate;
$sdk = Unify\Apideck::builder()
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\AccountingPurchaseOrdersUpdateRequest(
id: '<id>',
serviceId: 'salesforce',
companyId: '12345',
purchaseOrder: new Components\PurchaseOrderInput(
poNumber: '90000117',
reference: '123456',
supplier: new Components\LinkedSupplierInput(
id: '12345',
displayName: 'Windsurf Shop',
address: 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: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
),
subsidiaryId: '12345',
companyId: '12345',
status: Components\PurchaseOrderStatus::Open,
issuedDate: LocalDate::parse('2020-09-30'),
deliveryDate: LocalDate::parse('2020-09-30'),
expectedArrivalDate: LocalDate::parse('2020-09-30'),
currency: Components\Currency::Usd,
currencyRate: 0.69,
subTotal: 27500,
totalTax: 2500,
total: 27500,
taxInclusive: true,
lineItems: [
new Components\InvoiceLineItemInput(
id: '12345',
rowId: '12345',
code: '120-C',
lineNumber: 1,
description: 'Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.',
type: Components\InvoiceLineItemType::SalesItem,
taxAmount: 27500,
totalAmount: 27500,
quantity: 1,
unitPrice: 27500.5,
unitOfMeasure: 'pc.',
discountPercentage: 0.01,
discountAmount: 19.99,
locationId: '12345',
departmentId: '12345',
item: new Components\LinkedInvoiceItem(
id: '12344',
code: '120-C',
name: 'Model Y',
),
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
trackingCategories: null,
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
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',
),
],
rowVersion: '1-12345',
),
new Components\InvoiceLineItemInput(
id: '12345',
rowId: '12345',
code: '120-C',
lineNumber: 1,
description: 'Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.',
type: Components\InvoiceLineItemType::SalesItem,
taxAmount: 27500,
totalAmount: 27500,
quantity: 1,
unitPrice: 27500.5,
unitOfMeasure: 'pc.',
discountPercentage: 0.01,
discountAmount: 19.99,
locationId: '12345',
departmentId: '12345',
item: new Components\LinkedInvoiceItem(
id: '12344',
code: '120-C',
name: 'Model Y',
),
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
trackingCategories: null,
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
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',
),
],
rowVersion: '1-12345',
),
],
shippingAddress: 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: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
ledgerAccount: new Components\LinkedLedgerAccount(
id: '123456',
nominalCode: 'N091',
code: '453',
),
templateId: '123456',
discountPercentage: 5.5,
bankAccount: new Components\BankAccount(
bankName: 'Monzo',
accountNumber: '123465',
accountName: 'SPACEX LLC',
accountType: Components\AccountType::CreditCard,
iban: 'CH2989144532982975332',
bic: 'AUDSCHGGXXX',
routingNumber: '012345678',
bsbNumber: '062-001',
branchIdentifier: '001',
bankCode: 'BNH',
currency: Components\Currency::Usd,
),
accountingByRow: false,
dueDate: LocalDate::parse('2020-10-30'),
paymentMethod: 'cash',
taxCode: '1234',
channel: 'email',
memo: 'Thank you for the partnership and have a great day!',
trackingCategories: [
new Components\LinkedTrackingCategory(
id: '123456',
name: 'New York',
),
],
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',
),
],
rowVersion: '1-12345',
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->accounting->purchaseOrders->update(
request: $request
);
if ($response->updatePurchaseOrderResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\AccountingPurchaseOrdersUpdateRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingPurchaseOrdersUpdateResponse
| 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 Purchase Order
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\AccountingPurchaseOrdersDeleteRequest(
id: '<id>',
serviceId: 'salesforce',
companyId: '12345',
);
$response = $sdk->accounting->purchaseOrders->delete(
request: $request
);
if ($response->deletePurchaseOrderResponse !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\AccountingPurchaseOrdersDeleteRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingPurchaseOrdersDeleteResponse
| 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 | */* |