Skip to content

Latest commit

 

History

History
847 lines (761 loc) · 128 KB

README.md

File metadata and controls

847 lines (761 loc) · 128 KB

PurchaseOrders

(accounting.purchase_orders)

Overview

Available Operations

  • list - List Purchase Orders
  • create - Create Purchase Order
  • get - Get Purchase Order
  • update - Update Purchase Order
  • delete - Delete Purchase Order

list

List Purchase Orders

Example Usage

import apideck_unify
from apideck_unify import Apideck
from apideck_unify.utils import parse_datetime
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.purchase_orders.list(raw=False, service_id="salesforce", company_id="12345", pass_through={
        "search": "San Francisco",
    }, limit=20, filter_={
        "updated_since": parse_datetime("2020-09-30T07:43:32.000Z"),
        "supplier_id": "1234",
    }, sort={
        "by": apideck_unify.PurchaseOrdersSortBy.UPDATED_AT,
        "direction": apideck_unify.SortDirection.DESC,
    })

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
cursor OptionalNullable[str] ➖ Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
pass_through Dict[str, Any] ➖ Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads {
"search": "San Francisco"
}
limit Optional[int] ➖ Number of results to return. Minimum 1, Maximum 200, Default 20
filter_ Optional[models.PurchaseOrdersFilter] ➖ Apply filters {
"updated_since": "2020-09-30T07:43:32.000Z",
"supplier_id": "1234"
}
sort Optional[models.PurchaseOrdersSort] ➖ Apply sorting {
"by": "updated_at",
"direction": "desc"
}
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingPurchaseOrdersAllResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

create

Create Purchase Order

Example Usage

import apideck_unify
from apideck_unify import Apideck
from datetime import date
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.purchase_orders.create(raw=False, service_id="salesforce", company_id_param="12345", display_id="12345", po_number="90000117", reference="123456", supplier={
        "id": "12345",
        "display_name": "Windsurf Shop",
        "address": {
            "id": "123",
            "type": apideck_unify.Type.PRIMARY,
            "string": "25 Spring Street, Blackburn, VIC 3130",
            "name": "HQ US",
            "line1": "Main street",
            "line2": "apt #",
            "line3": "Suite #",
            "line4": "delivery instructions",
            "street_number": "25",
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94104",
            "country": "US",
            "latitude": "40.759211",
            "longitude": "-73.984638",
            "county": "Santa Clara",
            "contact_name": "Elon Musk",
            "salutation": "Mr",
            "phone_number": "111-111-1111",
            "fax": "122-111-1111",
            "email": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    }, subsidiary_id="12345", company_id="12345", location_id="12345", department_id="12345", status=apideck_unify.PurchaseOrderStatus.OPEN, issued_date=date.fromisoformat("2020-09-30"), delivery_date=date.fromisoformat("2020-09-30"), expected_arrival_date=date.fromisoformat("2020-09-30"), currency=apideck_unify.Currency.USD, currency_rate=0.69, sub_total=27500, total_tax=2500, total=27500, tax_inclusive=True, line_items=[
        {
            "id": "12345",
            "row_id": "12345",
            "code": "120-C",
            "line_number": 1,
            "description": "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
            "type": apideck_unify.InvoiceLineItemType.SALES_ITEM,
            "tax_amount": 27500,
            "total_amount": 27500,
            "quantity": 1,
            "unit_price": 27500.5,
            "unit_of_measure": "pc.",
            "discount_percentage": 0.01,
            "discount_amount": 19.99,
            "location_id": "12345",
            "department_id": "12345",
            "item": {
                "id": "12344",
                "code": "120-C",
                "name": "Model Y",
            },
            "tax_rate": {
                "id": "123456",
                "rate": 10,
            },
            "tracking_categories": [
                {
                    "id": "123456",
                    "name": "New York",
                },
                {
                    "id": "123456",
                    "name": "New York",
                },
                {
                    "id": "123456",
                    "name": "New York",
                },
            ],
            "ledger_account": {
                "id": "123456",
                "nominal_code": "N091",
                "code": "453",
            },
            "custom_fields": [
                {
                    "id": "2389328923893298",
                    "name": "employee_level",
                    "description": "Employee Level",
                    "value": 10,
                },
                {
                    "id": "2389328923893298",
                    "name": "employee_level",
                    "description": "Employee Level",
                    "value": 10,
                },
                {
                    "id": "2389328923893298",
                    "name": "employee_level",
                    "description": "Employee Level",
                    "value": 10,
                },
            ],
            "row_version": "1-12345",
        },
    ], billing_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "line5": "Attention: Finance Dept",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, shipping_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, ledger_account={
        "id": "123456",
        "nominal_code": "N091",
        "code": "453",
    }, template_id="123456", discount_percentage=5.5, bank_account={
        "bank_name": "Monzo",
        "account_number": "123465",
        "account_name": "SPACEX LLC",
        "account_type": apideck_unify.AccountType.CREDIT_CARD,
        "iban": "CH2989144532982975332",
        "bic": "AUDSCHGGXXX",
        "routing_number": "012345678",
        "bsb_number": "062-001",
        "branch_identifier": "001",
        "bank_code": "BNH",
        "currency": apideck_unify.Currency.USD,
    }, accounting_by_row=False, due_date=date.fromisoformat("2020-10-30"), payment_method="cash", terms="Net 30 days", terms_id="12345", tax_code="1234", tax_method="Due to supplier", issued_method="Email", issued_email="john.doe@example.com", channel="email", memo="Thank you for the partnership and have a great day!", notes="This is a test purchase order", tracking_categories=[
        {
            "id": "123456",
            "name": "New York",
        },
        {
            "id": "123456",
            "name": "New York",
        },
        {
            "id": "123456",
            "name": "New York",
        },
    ], custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": 10,
        },
    ], row_version="1-12345", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.create_purchase_order_response is not None

    # Handle response
    print(res.create_purchase_order_response)

Parameters

Parameter Type Required Description Example
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
company_id_param Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
display_id OptionalNullable[str] ➖ Display ID of the purchase order 12345
po_number OptionalNullable[str] ➖ A PO Number uniquely identifies a purchase order and is generally defined by the buyer. 90000117
reference OptionalNullable[str] ➖ Optional purchase order reference. 123456
supplier OptionalNullable[models.LinkedSupplierInput] ➖ The supplier this entity is linked to.
subsidiary_id OptionalNullable[str] ➖ The ID of the subsidiary 12345
company_id OptionalNullable[str] ➖ The company ID the transaction belongs to 12345
location_id OptionalNullable[str] ➖ The ID of the location 12345
department_id OptionalNullable[str] ➖ The ID of the department 12345
status OptionalNullable[models.PurchaseOrderStatus] ➖ N/A open
issued_date datetime ➖ Date purchase order was issued - YYYY-MM-DD. 2020-09-30
delivery_date datetime ➖ The date on which the purchase order is to be delivered - YYYY-MM-DD. 2020-09-30
expected_arrival_date datetime ➖ The date on which the order is expected to arrive - YYYY-MM-DD. 2020-09-30
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
currency_rate OptionalNullable[float] ➖ Currency Exchange Rate at the time entity was recorded/generated. 0.69
sub_total OptionalNullable[float] ➖ Sub-total amount, normally before tax. 27500
total_tax OptionalNullable[float] ➖ Total tax amount applied to this invoice. 2500
total OptionalNullable[float] ➖ Total amount of invoice, including tax. 27500
tax_inclusive OptionalNullable[bool] ➖ Amounts are including tax true
line_items List[models.InvoiceLineItemInput] ➖ N/A
billing_address Optional[models.Address] ➖ N/A
shipping_address Optional[models.Address] ➖ N/A
ledger_account OptionalNullable[models.LinkedLedgerAccount] ➖ N/A
template_id OptionalNullable[str] ➖ Optional purchase order template 123456
discount_percentage OptionalNullable[float] ➖ Discount percentage applied to this transaction. 5.5
bank_account Optional[models.BankAccount] ➖ N/A
accounting_by_row OptionalNullable[bool] ➖ Indicates if accounting by row is used (true) or not (false). Accounting by row means that a separate ledger transaction is created for each row. false
due_date datetime ➖ The due date is the date on which a payment is scheduled to be received - YYYY-MM-DD. 2020-10-30
payment_method OptionalNullable[str] ➖ Payment method used for the transaction, such as cash, credit card, bank transfer, or check cash
terms OptionalNullable[str] ➖ Terms of payment. Net 30 days
terms_id OptionalNullable[str] ➖ The ID of the payment terms 12345
amortization_type OptionalNullable[models.PurchaseOrderAmortizationType] ➖ Type of amortization
tax_code OptionalNullable[str] ➖ Applicable tax id/code override if tax is not supplied on a line item basis. 1234
tax_method OptionalNullable[str] ➖ Method of tax calculation Due to supplier
issued_method OptionalNullable[str] ➖ Method of issuance of the purchase order Email
issued_email OptionalNullable[str] ➖ Email address of the person who issued the purchase order john.doe@example.com
channel OptionalNullable[str] ➖ The channel through which the transaction is processed. email
memo OptionalNullable[str] ➖ Message for the supplier. This text appears on the Purchase Order. Thank you for the partnership and have a great day!
notes OptionalNullable[str] ➖ Internal notes for the purchase order. This is a test purchase order
tracking_categories List[Nullable[models.LinkedTrackingCategory]] ➖ A list of linked tracking categories.
custom_fields List[models.CustomField] ➖ N/A
row_version OptionalNullable[str] ➖ A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. 1-12345
pass_through List[models.PassThroughBody] ➖ The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingPurchaseOrdersAddResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

get

Get Purchase Order

Example Usage

from apideck_unify import Apideck
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.purchase_orders.get(id="<id>", service_id="salesforce", company_id="12345", raw=False)

    assert res.get_purchase_order_response is not None

    # Handle response
    print(res.get_purchase_order_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingPurchaseOrdersOneResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

update

Update Purchase Order

Example Usage

import apideck_unify
from apideck_unify import Apideck
from datetime import date
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.purchase_orders.update(id="<id>", service_id="salesforce", company_id_param="12345", raw=False, display_id="12345", po_number="90000117", reference="123456", supplier={
        "id": "12345",
        "display_name": "Windsurf Shop",
        "address": {
            "id": "123",
            "type": apideck_unify.Type.PRIMARY,
            "string": "25 Spring Street, Blackburn, VIC 3130",
            "name": "HQ US",
            "line1": "Main street",
            "line2": "apt #",
            "line3": "Suite #",
            "line4": "delivery instructions",
            "street_number": "25",
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94104",
            "country": "US",
            "latitude": "40.759211",
            "longitude": "-73.984638",
            "county": "Santa Clara",
            "contact_name": "Elon Musk",
            "salutation": "Mr",
            "phone_number": "111-111-1111",
            "fax": "122-111-1111",
            "email": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    }, subsidiary_id="12345", company_id="12345", location_id="12345", department_id="12345", status=apideck_unify.PurchaseOrderStatus.OPEN, issued_date=date.fromisoformat("2020-09-30"), delivery_date=date.fromisoformat("2020-09-30"), expected_arrival_date=date.fromisoformat("2020-09-30"), currency=apideck_unify.Currency.USD, currency_rate=0.69, sub_total=27500, total_tax=2500, total=27500, tax_inclusive=True, line_items=[
        {
            "id": "12345",
            "row_id": "12345",
            "code": "120-C",
            "line_number": 1,
            "description": "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
            "type": apideck_unify.InvoiceLineItemType.SALES_ITEM,
            "tax_amount": 27500,
            "total_amount": 27500,
            "quantity": 1,
            "unit_price": 27500.5,
            "unit_of_measure": "pc.",
            "discount_percentage": 0.01,
            "discount_amount": 19.99,
            "location_id": "12345",
            "department_id": "12345",
            "item": {
                "id": "12344",
                "code": "120-C",
                "name": "Model Y",
            },
            "tax_rate": {
                "id": "123456",
                "rate": 10,
            },
            "tracking_categories": [
                {
                    "id": "123456",
                    "name": "New York",
                },
                {
                    "id": "123456",
                    "name": "New York",
                },
            ],
            "ledger_account": {
                "id": "123456",
                "nominal_code": "N091",
                "code": "453",
            },
            "custom_fields": [
                {
                    "id": "2389328923893298",
                    "name": "employee_level",
                    "description": "Employee Level",
                    "value": {

                    },
                },
            ],
            "row_version": "1-12345",
        },
    ], billing_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "line5": "Attention: Finance Dept",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, shipping_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, ledger_account={
        "id": "123456",
        "nominal_code": "N091",
        "code": "453",
    }, template_id="123456", discount_percentage=5.5, bank_account={
        "bank_name": "Monzo",
        "account_number": "123465",
        "account_name": "SPACEX LLC",
        "account_type": apideck_unify.AccountType.CREDIT_CARD,
        "iban": "CH2989144532982975332",
        "bic": "AUDSCHGGXXX",
        "routing_number": "012345678",
        "bsb_number": "062-001",
        "branch_identifier": "001",
        "bank_code": "BNH",
        "currency": apideck_unify.Currency.USD,
    }, accounting_by_row=False, due_date=date.fromisoformat("2020-10-30"), payment_method="cash", terms="Net 30 days", terms_id="12345", tax_code="1234", tax_method="Due to supplier", issued_method="Email", issued_email="john.doe@example.com", channel="email", memo="Thank you for the partnership and have a great day!", notes="This is a test purchase order", tracking_categories=[
        {
            "id": "123456",
            "name": "New York",
        },
        {
            "id": "123456",
            "name": "New York",
        },
        {
            "id": "123456",
            "name": "New York",
        },
    ], custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": {

            },
        },
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": {

            },
        },
    ], row_version="1-12345", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.update_purchase_order_response is not None

    # Handle response
    print(res.update_purchase_order_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
company_id_param Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
display_id OptionalNullable[str] ➖ Display ID of the purchase order 12345
po_number OptionalNullable[str] ➖ A PO Number uniquely identifies a purchase order and is generally defined by the buyer. 90000117
reference OptionalNullable[str] ➖ Optional purchase order reference. 123456
supplier OptionalNullable[models.LinkedSupplierInput] ➖ The supplier this entity is linked to.
subsidiary_id OptionalNullable[str] ➖ The ID of the subsidiary 12345
company_id OptionalNullable[str] ➖ The company ID the transaction belongs to 12345
location_id OptionalNullable[str] ➖ The ID of the location 12345
department_id OptionalNullable[str] ➖ The ID of the department 12345
status OptionalNullable[models.PurchaseOrderStatus] ➖ N/A open
issued_date datetime ➖ Date purchase order was issued - YYYY-MM-DD. 2020-09-30
delivery_date datetime ➖ The date on which the purchase order is to be delivered - YYYY-MM-DD. 2020-09-30
expected_arrival_date datetime ➖ The date on which the order is expected to arrive - YYYY-MM-DD. 2020-09-30
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
currency_rate OptionalNullable[float] ➖ Currency Exchange Rate at the time entity was recorded/generated. 0.69
sub_total OptionalNullable[float] ➖ Sub-total amount, normally before tax. 27500
total_tax OptionalNullable[float] ➖ Total tax amount applied to this invoice. 2500
total OptionalNullable[float] ➖ Total amount of invoice, including tax. 27500
tax_inclusive OptionalNullable[bool] ➖ Amounts are including tax true
line_items List[models.InvoiceLineItemInput] ➖ N/A
billing_address Optional[models.Address] ➖ N/A
shipping_address Optional[models.Address] ➖ N/A
ledger_account OptionalNullable[models.LinkedLedgerAccount] ➖ N/A
template_id OptionalNullable[str] ➖ Optional purchase order template 123456
discount_percentage OptionalNullable[float] ➖ Discount percentage applied to this transaction. 5.5
bank_account Optional[models.BankAccount] ➖ N/A
accounting_by_row OptionalNullable[bool] ➖ Indicates if accounting by row is used (true) or not (false). Accounting by row means that a separate ledger transaction is created for each row. false
due_date datetime ➖ The due date is the date on which a payment is scheduled to be received - YYYY-MM-DD. 2020-10-30
payment_method OptionalNullable[str] ➖ Payment method used for the transaction, such as cash, credit card, bank transfer, or check cash
terms OptionalNullable[str] ➖ Terms of payment. Net 30 days
terms_id OptionalNullable[str] ➖ The ID of the payment terms 12345
amortization_type OptionalNullable[models.PurchaseOrderAmortizationType] ➖ Type of amortization
tax_code OptionalNullable[str] ➖ Applicable tax id/code override if tax is not supplied on a line item basis. 1234
tax_method OptionalNullable[str] ➖ Method of tax calculation Due to supplier
issued_method OptionalNullable[str] ➖ Method of issuance of the purchase order Email
issued_email OptionalNullable[str] ➖ Email address of the person who issued the purchase order john.doe@example.com
channel OptionalNullable[str] ➖ The channel through which the transaction is processed. email
memo OptionalNullable[str] ➖ Message for the supplier. This text appears on the Purchase Order. Thank you for the partnership and have a great day!
notes OptionalNullable[str] ➖ Internal notes for the purchase order. This is a test purchase order
tracking_categories List[Nullable[models.LinkedTrackingCategory]] ➖ A list of linked tracking categories.
custom_fields List[models.CustomField] ➖ N/A
row_version OptionalNullable[str] ➖ A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. 1-12345
pass_through List[models.PassThroughBody] ➖ The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingPurchaseOrdersUpdateResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

delete

Delete Purchase Order

Example Usage

from apideck_unify import Apideck
import os


with Apideck(
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:

    res = apideck.accounting.purchase_orders.delete(id="<id>", service_id="salesforce", company_id="12345", raw=False)

    assert res.delete_purchase_order_response is not None

    # Handle response
    print(res.delete_purchase_order_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
consumer_id Optional[str] ➖ ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] ➖ The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
service_id Optional[str] ➖ Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
raw Optional[bool] ➖ Include raw response. Mostly used for debugging purposes
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingPurchaseOrdersDeleteResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*