api.purchase_orders

/api/purchase_orders/

GET /api/purchase_orders/

Description:

Get a list of Purchase Orders
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<purchase_orders>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <purchase_order_id>[str]</purchase_order_id>
        <status>[enum: Cancelled | Processed | Partially Received | Received | Invoiced | None]</status>
        <printing>
            <print_language>[str]</print_language>
        </printing>
        <transfer_store_code>[str]</transfer_store_code>
        <supplier_name>[str]</supplier_name>
    </purchase_order>
    [...]
</purchase_orders>

POST /api/purchase_orders/

Description:

Create a Purchase Order
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<purchase_order>
    <tax_code id="X"/> <!-- mandatory -->
    <currency id="Y"/> <!-- mandatory -->
    <user id="U"/> <!-- optional, defaults to the current user -->
    <ref>[str]</ref> <!-- optional -->
    <po_supplier> <!-- optional -->
        <supplier id="Z"> <!-- optional -->
        <name>[str]</name> <!-- optional -->
        <mainphone>[str]</mainphone>
        <phone_or_emails>
         <phone_or_email>
            <value>[str]</value>
         </phone_or_email>
          [...]
        </phone_or_emails> <!-- optional -->
        <contact>[str]</contact> <!-- optional -->
        <currency_terms_tax_status>[str]</currency_terms_tax_status> <!-- optional -->
        <billing>
            <address>
                <address1>[str]</address1>  <!-- optional -->
                <address2>[str]</address2>  <!-- optional -->
                <city>[str]</city>  <!-- optional -->
                <state>[str]</state>  <!-- optional -->
                <country>[str]</country>  <!-- optional -->
                <zip>[str]</zip>  <!-- optional -->
            </address>
         </billing>  <!-- optional -->
         <shipping_address>
            <address>
                <address1>[str]</address1>  <!-- optional -->
                <address2>[str]</address2>  <!-- optional -->
                <city>[str]</city>  <!-- optional -->
                <state>[str]</state>  <!-- optional -->
                <country>[str]</country>  <!-- optional -->
                <zip>[str]</zip>  <!-- optional -->
            </address>
          </shipping_address>  <!-- optional -->
    </po_supplier>
    <shipping_method/>[str]</shipping_method> <!-- Optional -->
    <drop_shipment> <!-- Optional -->
        <customer id="[int]"/>
    </drop_shipment>
    <eta>[str]</eta> <!-- Optional -->
    <status>[enum: Cancelled | Processed | Partially Received | Received | Invoiced | None]</status> <!-- Optional -->
    <printing>
        <print_language>[str]</print_language> <!-- Optional -->
        <print_discounts>[bool]</print_discounts> <!-- Optional -->
        <print_customers>[bool]</print_customers> <!-- Optional -->
        <print_serial_numbers>[bool]</print_serial_numbers> <!-- Optional -->
    </printing>
    <printed_notes>[str]</printed_notes>
    <internal_notes>[str]</internal_notes>
    <source> <!-- Optional -->
        <order id="[int]">
            <lineitems>  <!-- Optional, only available when creating a Purchase Order from an Order.  Choose specific lines from the order to create the Purchase Order. -->
                <lineitem id="[int]"/>
            </lineitems>
        </order>
    </source>
</purchase_order>

Response:

<purchase_order uri="/purchase_orders/X/" id="X">
    <!-- See GET /purchase_orders/X/ response for details. -->
</purchase_order>

/api/purchase_orders/(d+)/

GET /api/purchase_orders/(d+)/

Description:

Get details of a specific Purchase Orders
can_lock requires_lock has_etag requires_etag
True False False False

Request:

<!-- No XML Request. -->

Response:

<purchase_order uri="/purchase_orders/A/" id="A">
    <purchase_order_id>[str]</purchase_order_id>
    <tax_code id="X" uri="/tax_codes/X/" full_render='false'>
        <name>[str]</name>
    </tax_code>
    <currency id="Y" uri="/setup/currencies/Y/" full_render='true'>
        <!-- see GET /setup/currencies/x/ response -->
    </currency>
    <user id="U" uri="/users/U/" full_render='false'>
        <fullname>[str]</fullname>
    </user>
    <ref>[string]</ref>
    <status>[enum: Cancelled | Processed | Partially Received | Received | Invoiced | None]</status>
    <transfer_store_code>[str]</transfer_store_code>
    <po_supplier>
        <supplier id="Z" uri="/suppliers/Z/"/>
        <name>[str]</name>
        <mainphone>[str]</mainphone>
        <phone_or_emails>
         <phone_or_email>
            <value>[str]</value>
         </phone_or_email>
          [...]
        </phone_or_emails>
        <contact>[str]</contact>
        <currency_terms_tax_status>[str]</currency_terms_tax_status>
        <billing>
            <address>
                <address1>[str]</address1>
                <address2>[str]</address2>
                <city>[str]</city>
                <state>[str]</state>
                <country>[str]</country>
                <zip>[str]</zip>
            </address>
         </billing>
         <shipping>
            <address>
                <address1>[str]</address1>
                <address2>[str]</address2>
                <city>[str]</city>
                <state>[str]</state>
                <country>[str]</country>
                <zip>[str]</zip>
            </address>
          </shipping>
    </po_supplier>
    <taxes>
        <tax id="[int]"> <!-- 5 taxes -->
            <total>[money]></total>
        </tax>
        [...]
    </taxes>
    <totals>
        <subtotal>[money]</subtotal>
        <tax>[money]</tax>
        <total>[money]</total>
    </totals>
    <created>[datetime]</created>
    <modified>[datetime]</modified>
    <shipping_method/>[str]</shipping_method>
    <drop_shipment>
        <customer uri="/customers/C/" id="C">
            <!-- See GET /customers/X/ for details. -->
        </customer>
    </drop_shipment>
    <eta>[str]</eta>
    <printing>
        <print_language>[str]</print_language>
        <print_discounts>[bool]</print_discounts>
        <print_customers>[bool]</print_customers>
        <print_serial_numbers>[bool]</print_serial_numbers>
    </printing>
    <printed_notes>[str]</printed_notes>
    <internal_notes>[str]</internal_notes>
    <lineitems>
        <lineitem uri="/purchase_orders/A/lineitems/D/" id="D" full_render="true">
            <!-- See GET /purchase_orders/X/lineitems/Y/ response for details. -->
        </lineitem>
        [...]
    </lineitems>
</purchase_order>

PUT /api/purchase_orders/(d+)/

Description:

Update a Purchase Order
can_lock requires_lock has_etag requires_etag
True True False False

Request:

<purchase_order>
    <tax_code id="X"/> <!-- optional -->
    <currency id="Y"/> <!-- optional -->
    <user id="U"/> <!-- optional -->
    <ref>[str]</ref> <!-- optional -->
    <po_supplier> <!-- optional -->
        <supplier id="Z"> <!-- optional, supplier information removed if empty <supplier/> tag in request-->
        <name>[text]</name> <!-- optional -->
        <mainphone>[str]</mainphone>
        <phone_or_emails>
         <phone_or_email>
            <value>[str]</value>
         </phone_or_email>
          [...]
        </phone_or_emails> <!-- optional -->
        <contact>[str]</contact> <!-- optional -->
        <currency_terms_tax_status>[str]</currency_terms_tax_status> <!-- optional -->
        <billing>
            <address>
                <address1>[str]</address1>  <!-- optional -->
                <address2>[str]</address2>  <!-- optional -->
                <city>[str]</city>  <!-- optional -->
                <state>[str]</state>  <!-- optional -->
                <country>[str]</country>  <!-- optional -->
                <zip>[str]</zip>  <!-- optional -->
            </address>
         </billing>  <!-- optional -->
         <shipping_address>
            <address>
                <address1>[str]</address1>  <!-- optional -->
                <address2>[str]</address2>  <!-- optional -->
                <city>[str]</city>  <!-- optional -->
                <state>[str]</state>  <!-- optional -->
                <country>[str]</country>  <!-- optional -->
                <zip>[str]</zip>  <!-- optional -->
            </address>
          </shipping_address>  <!-- optional -->
    </po_supplier>
    <shipping_method/>[str]</shipping_method> <!-- Optional -->
    <drop_shipment> <!-- Optional, nullable -->
        <customer id="[int]"/>
    </drop_shipment>
    <eta>[str]</eta> <!-- Optional -->
    <status>[enum: Cancelled | Processed | Partially Received | Received | Invoiced | None]</status> <!-- Optional -->
    <printing>
        <print_language>[str]</print_language> <!-- Optional -->
        <print_discounts>[bool]</print_discounts> <!-- Optional -->
        <print_customers>[bool]</print_customers> <!-- Optional -->
        <print_serial_numbers>[bool]</print_serial_numbers> <!-- Optional -->
    </printing>
    <printed_notes>[str]</printed_notes>
    <internal_notes>[str]</internal_notes>
    <source> <!-- Optional -->
        <order id="[int]"/>
    </source>
</purchase_order>

Response:

<purchase_order uri="/purchase_orders/X/" id="X">
    <!-- See GET /purchase_orders/X/ response for details. -->
</purchase_order>
Expected Errors:

DELETE /api/purchase_orders/(d+)/

Description:

Delete a PO
can_lock requires_lock has_etag requires_etag
True True False False

Request:

<!-- No XML Request -->

Response:

<purchase_order uri="/purchase_orders/X/" id="X" delete="true"/>
Expected Errors:

/api/purchase_orders/(d+)/lineitems/

GET /api/purchase_orders/(d+)/lineitems/

Description:

Returns the list of purchase order line items.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<lineitems>
    <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y"/>
    [...]
</lineitems>

POST /api/purchase_orders/(d+)/lineitems/

Description:

Create a PO Lineitem
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<lineitem>
    <cost>[decimal]</cost> <!-- Optional. Overwrite the default cost from the supplier. -->
    <discount> <!-- Optional -->
        <percent>[decimal]</percent> <!-- Mutually exclusive with value -->
        <value>[decimal]</value> <!-- Mutually exclusive with percent -->
    </discount>
    <eta_note>[str]</eta_note> <!-- Optional -->
    <list_order>[int]</list_order> <!-- Optional -->
    <product id="[int]"/> <!-- Mandatory -->
    <quantity>[decimal]</quantity> <!-- Mandatory -->
    <taxes> <!-- Optional -->
        <tax id="[int]"> <!-- Up to 5 -->
            <exempt>[bool]</exempt>
        </tax>
        [...]
    </taxes>
</lineitem>

Response:

<response>
    <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y">
        <!-- See GET /purchase_orders/X/lineitems/Y/ response for details. -->
    </lineitem>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <!-- See GET /purchase_orders/X/ response for details. -->
        <lineitems> <!-- We only render lineitems URI in this case. -->
            <lineitem uri="/purchase_orders/A/lineitems/D/" id="D"/>
            [...]
        </lineitems>
    </purchase_order>
</response>
Expected Errors:

/api/purchase_orders/(d+)/lineitems/(d+)/

GET /api/purchase_orders/(d+)/lineitems/(d+)/

Description:

Returns a specific purchase order line item.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No xml request -->

Response:

<lineitem uri="/purchase_orders/A/lineitems/B/" id="B">
    <quantity>[decimal]</quantity>
    <quantity_back_ordered>[decimal]</quantity_back_ordered>
    <quantity_received>[decimal]</quantity_received>
    <quantity_in_stock>[decimal]</quantity_in_stock>
    <serial_numbers>
        <serial_number>[str]</serial_number>
        [...]
    </serial_numbers>
    <eta_note>[str]</eta_note>
    <list_order>[int]</list_order>
    <discount>
        <percent>[decimal]</percent> <!-- Mutually exclusive with value -->
        <value>[decimal]</value> <!-- Mutually exclusive with percent -->
    </discount>
    <costs>
        <base>[money]</base>
        <cost>[money]</cost>
        <total>[money]</total>
    </costs>
    <taxes>
        <tax id="[int]"> <!-- 5 taxes -->
            <exempt>[bool]</exempt>
            <total>[money]></total>
        </tax>
        [...]
    </taxes>
    <lineitem_product>
        <product uri="/products/C/" id="C"/>
        <code>[str]</code>
        <description>[str]</description>
        <serialized>[bool]</serialized>
        <supplier_product_code>[str]</supplier_product_code>
        <manufacturer_part_number>[str]</manufacturer_part_number>
        <manufacturer_pricing_option_code>[str]</manufacturer_pricing_option_code>
    </lineitem_product>
</lineitem>

PUT /api/purchase_orders/(d+)/lineitems/(d+)/

Description:

Update a PO Lineitem
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<lineitem>
    <cost>[decimal]</cost> <!-- Optional. Overwrite the default cost from the supplier. -->
    <discount> <!-- Optional -->
        <percent>[decimal]</percent> <!-- Mutually exclusive with value -->
        <value>[decimal]</value> <!-- Mutually exclusive with percent -->
    </discount>
    <eta_note>[str]</eta_note> <!-- Optional -->
    <list_order>[int]</list_order> <!-- Optional -->
    <quantity>[decimal]</quantity> <!-- Optional -->
    <taxes> <!-- Optional -->
        <tax id="[int]"> <!-- Up to 5 -->
            <exempt>[bool]</exempt>
        </tax>
        [...]
    </taxes>
</lineitem>

Response:

<response>
    <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y">
        <!-- See GET /purchase_orders/X/lineitems/Y/ response for details. -->
    </lineitem>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <!-- See GET /purchase_orders/X/ response for details. -->
        <lineitems> <!-- We only render lineitems URI in this case. -->
            <lineitem uri="/purchase_orders/A/lineitems/D/" id="D"/>
            [...]
        </lineitems>
    </purchase_order>
</response>
Expected Errors:

DELETE /api/purchase_orders/(d+)/lineitems/(d+)/

Description:

Delete a PO Lineitem
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<!-- No XML request -->

Response:

<response>
    <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y" deleted="true"/>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <!-- See GET /purchase_orders/X/ response for details. -->
        <lineitems> <!-- We only render lineitems URI in this case. -->
            <lineitem uri="/purchase_orders/A/lineitems/D/" id="D"/>
            [...]
        </lineitems>
    </purchase_order>
</response>
Expected Errors:

/api/purchase_orders/(d+)/receive/

POST /api/purchase_orders/(d+)/receive/

Description:

Receive a PO's inventory.
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<receive>
    <inventory> <!-- At least 1 must be provided -->
        <product id="[int]"/> <!-- Mandatory, mutually exclusive with supplier_product_code -->
        <supplier_product_code>[str]</supplier_product_code> <!-- Mandatory, mutually exclusive with product_id -->
        <quantity>[decimal]</quantity> <!-- Mandatory, mutually exclusive with serial_numbers. -->
        <serial_numbers> <!-- Mandatory, mutual exclusive with quantity. -->
            <serial_number>[str]</serial_number> <!-- At least 1 must be provided. -->
            [...]
        </serial_numbers>
        <reserve_on_linked_orders>[bool]</reserve_on_linked_orders> <!-- Optional. Default False. -->
    </inventory>
    [...]
</receive>

Response:

<response>
    <lineitems> <!-- All line items that received inventories in this request. -->
        <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y">
            <!-- See GET /purchase_orders/X/lineitems/ response for details. -->
        </lineitem>
        [...]
    </lineitems>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <!-- See GET /purchase_orders/X/ response for details. -->
        <lineitems> <!-- We only render lineitems URI in this case. -->
            <lineitem uri="/purchase_orders/A/lineitems/D/" id="D"/>
            [...]
        </lineitems>
    </purchase_order>
    <orders>
        <!-- All orders that have had quantity reserved on them in this request. -->
        <order uri="/orders/X/" id="X"/>
        [...]
    </orders>
</response>
Expected Errors:

/api/purchase_orders/(d+)/unreceive/

POST /api/purchase_orders/(d+)/unreceive/

Description:

Unreceive a PO's inventory.
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<unreceive>
    <inventory> <!-- At least 1 must be provided -->
        <product id="[int]"/> <!-- Mandatory, mutually exclusive with supplier_product_code -->
        <supplier_product_code>[str]</supplier_product_code> <!-- Mandatory, mutually exclusive with product_id -->
        <quantity>[decimal]</quantity> <!-- Mandatory, mutually exclusive with serial_numbers. -->
        <serial_numbers> <!-- Mandatory, mutual exclusive with quantity. -->
            <serial_number>[str]</serial_number> <!-- At least 1 must be provided. -->
            [...]
        </serial_numbers>
        <unreserve_on_linked_orders>[bool]</unreserve_on_linked_orders> <!-- Optional. Default False. -->
    </inventory>
    [...]
</unreceive>

Response:

<response>
    <lineitems> <!-- All line items that unreceived inventories in this request. -->
        <lineitem uri="/purchase_orders/X/lineitems/Y/" id="Y">
            <!-- See GET /purchase_orders/X/lineitems/ response for details. -->
        </lineitem>
        [...]
    </lineitems>
    <purchase_order uri="/purchase_orders/X/" id="X">
        <!-- See GET /purchase_orders/X/ response for details. -->
        <lineitems> <!-- We only render lineitems URI in this case. -->
            <lineitem uri="/purchase_orders/A/lineitems/D/" id="D"/>
            [...]
        </lineitems>
    </purchase_order>
    <orders>
        <!-- All orders that have had quantity unreserved on them in this request. -->
        <order uri="/orders/X/" id="X"/>
        [...]
    </orders>
</response>
Expected Errors:

/api/purchase_orders/default_settings/

GET /api/purchase_orders/default_settings/

Description:

Get the default settings such as currency and tax code
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<response>
    <currency uri="/setup/currencies/X/" id="X" full_render="true">
        <!-- See GET /setup/currencies/X/ -->
    </currency>
    <tax_code uri="/tax_codes/Y/" id="Y" full_render="true">
        <!-- See GET /tax_codes/Y/ -->
    </tax_code>
</response>
Expected Errors: