URL | https://www10.versaccounts.com/v1/order/:order_id/order_item[.xml | .json] |
Supported Methods | GET, POST, PUT,DELETE |
Description | Returns, creates, or deletes the Order Items related to a Sales Order |
Accepted Query Formats
GET /order/:order_id/order_item[.format] | retrieve all order_items for order with id = :order_id |
GET /order/:order_id/order_item/:id[.format] | retrieve an order_item with id = :id, which is related to order with id = :order_id |
POST /order/:order_id/order_item | create a new order item related to order with id = :order_id |
DELETE /order/:order_id/order_item/:id | delete order_item with id = :id |
Examples
Retrieve an order item (id=7265) related to a specified order (id = 2040) in XML format:
$ curl -i --header "VERSACCOUNTS_AUTHORIZATION:494d60c5b140f1900e04256eca0d599cc0214fcf" https://www10.versaccounts.com/v1/order/2040/order_item/7265.xml
Response:
<?xml version="1.0" encoding="UTF-8"?> <order-items type="array"> <order-item> <id type="integer">7265</id> <product-id type="integer">430</product-id> <quantity type="integer">1</quantity> <measurement-unit-id type="integer">1191</measurement-unit-id> <estimated-delivery-date type="datetime">2013-01-14T00:00:00Z</estimated-delivery-date> <per-unit-cost>31410.38</per-unit-cost> <measurement-unit-name>EA</measurement-unit-name> <practical-name>Cast Stone Lite - Custom / Custom detailing per project</practical-name> <line-item type="integer">1</line-item> <note-a>Please see the attached Schedule A for the detailed break-down</note-a> <note-b>This item is non-returnable</note-b> <order-item-applied-taxes type="array"> <order-item-applied-tax> <tax-id type="integer">291</tax-id> <amount type="decimal">3392.32</amount> <description>LineItemValue x HST</description> </order-item-applied-tax> </order-item-applied-taxes> <order-item-adjustments type="array"> <order-item-adjustment> <adjustment-type-id type="integer">289</adjustment-type-id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> <adjustment-type> <name>Discount</name> </adjustment-type> </order-item-adjustment> </order-item-adjustments> </order-item> </order-items>
Retrieve all order items for a specified order in XML format:
$ curl -i --header "VERSACCOUNTS_AUTHORIZATION:494d60c5b140f1900e04256eca0d599cc0214fcf" https://www10.versaccounts.com/v1/order/2040/order_item.xml
Response:
<?xml version="1.0" encoding="UTF-8"?> <order-items type="array"> <order-item> <id type="integer">7265</id> <product-id type="integer">430</product-id> <quantity type="integer">1</quantity> <measurement-unit-id type="integer">1191</measurement-unit-id> <estimated-delivery-date type="datetime">2013-01-14T00:00:00Z</estimated-delivery-date> <per-unit-cost>31410.38</per-unit-cost> <measurement-unit-name>EA</measurement-unit-name> <practical-name>Cast Stone Lite - Custom / Custom detailing per project</practical-name> <line-item type="integer">1</line-item> <note-a>Please see the attached Schedule A for the detailed break-down</note-a> <note-b>This item is non-returnable</note-b> <order-item-applied-taxes type="array"> <order-item-applied-tax> <tax-id type="integer">291</tax-id> <amount type="decimal">3392.32</amount> <description>LineItemValue x HST</description> </order-item-applied-tax> </order-item-applied-taxes> <order-item-adjustments type="array"> <order-item-adjustment> <adjustment-type-id type="integer">289</adjustment-type-id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> <adjustment-type> <name>Discount</name> </adjustment-type> </order-item-adjustment> </order-item-adjustments> </order-item> ... <order-item> ... </order-item> </order-items>
Create an Order Item on Order id 2040:
$ curl -X POST -H "Content-Type: application/xml" -d @new_order_item.xml -i --header "VERSACCOUNTS_AUTHORIZATION:494d60c5b140f1900e04256eca0d599cc0214fcf" https://www10.versaccounts.com/v1/order/2040/order_item.xml
Posted XML file:
<?xml version="1.0" encoding="UTF-8"?> <order_item> <product_id type="integer">430</product_id> <quantity type="integer">1</quantity> <measurement_unit_id type="integer">1191</measurement_unit_id> <estimated_delivery_date type="datetime">2013-01-14T00:00:00Z</estimated_delivery_date> <per_unit_cost>31410.38</per_unit_cost> <note_a>Please see the attached Schedule A for the detailed break-down</note_a> <note_b>This item is non-returnable</note_b> <order_item_applied_taxes type="array"> <order_item_applied_tax> <tax_id type="integer">291</tax_id> </order_item_applied_tax> <order_item_applied_tax> <tax_id type="integer">390</tax_id> </order_item_applied_tax> </order_item_applied_taxes> <order_item_adjustments type="array"> <order_item_adjustment> <adjustment_type_id type="integer">289</adjustment_type_id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> </order_item_adjustment> </order_item_adjustments> </order_item>
Alternate XML file with a series of OrderItems:
<?xml version="1.0" encoding="UTF-8"?> <order_items type="array"> <order_item> <product_id type="integer">430</product_id> <quantity type="integer">1</quantity> <measurement_unit_id type="integer">1191</measurement_unit_id> <estimated_delivery_date type="datetime">2013-01-14T00:00:00Z</estimated_delivery_date> <per_unit_cost>31410.38</per_unit_cost> <note_a>Please see the attached Schedule A for the detailed break-down</note_a> <note_b>This item is non-returnable</note_b> <order_item_applied_taxes type="array"> <order_item_applied_tax> <tax_id type="integer">291</tax_id> <amount type="decimal">3392.32</amount> </order_item_applied_tax> </order_item_applied_taxes> <order_item_adjustments type="array"> <order_item_adjustment> <adjustment_type_id type="integer">289</adjustment_type_id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> </order_item_adjustment> </order_item_adjustments> </order_item> <order_item> <product_id type="integer">430</product_id> <quantity type="integer">1</quantity> <measurement_unit_id type="integer">1191</measurement_unit_id> <estimated_delivery_date type="datetime">2013-01-14T00:00:00Z</estimated_delivery_date> <per_unit_cost>31410.38</per_unit_cost> <note_a>Please see the attached Schedule A for the detailed break-down</note_a> <note_b>This item is non-returnable</note_b> <order_item_applied_taxes type="array"> <order_item_applied_tax> <tax_id type="integer">291</tax_id> <amount type="decimal">3392.32</amount> </order_item_applied_tax> </order_item_applied_taxes> <order_item_adjustments type="array"> <order_item_adjustment> <adjustment_type_id type="integer">289</adjustment_type_id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> </order_item_adjustment> </order_item_adjustments> </order_item> </order_items>
Response:
<?xml version="1.0" encoding="UTF-8"?> <order-items type="array"> <order-item> <id type="integer">7265</id> <product-id type="integer">430</product-id> <quantity type="integer">1</quantity> <measurement-unit-id type="integer">1191</measurement-unit-id> <estimated-delivery-date type="datetime">2013-01-14T00:00:00Z</estimated-delivery-date> <per-unit-cost>31410.38</per-unit-cost> <measurement-unit-name>EA</measurement-unit-name> <practical-name>Cast Stone Lite - Custom / Custom detailing per project</practical-name> <line-item type="integer">1</line-item> <note-a>Please see the attached Schedule A for the detailed break-down</note-a> <note-b>This item is non-returnable</note-b> <order-item-applied-taxes type="array"> <order-item-applied-tax> <tax-id type="integer">291</tax-id> <amount type="decimal">3392.32</amount> <description>LineItemValue x HST</description> </order-item-applied-tax> </order-item-applied-taxes> <order-item-adjustments type="array"> <order-item-adjustment> <adjustment-type-id type="integer">289</adjustment-type-id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> <adjustment-type> <name>Discount</name> </adjustment-type> </order-item-adjustment> </order-item-adjustments> </order-item> ^^^ pre-existing OrderItems
vvv newly created OrderItem <order-item> <id type="integer">7589</id> <product-id type="integer">430</product-id> <quantity type="integer">1</quantity> <measurement-unit-id type="integer">1191</measurement-unit-id> <estimated-delivery-date type="datetime">2013-01-14T00:00:00Z</estimated-delivery-date> <per-unit-cost>31410.38</per-unit-cost> <measurement-unit-name>EA</measurement-unit-name> <practical-name>Cast Stone Lite - Custom / Custom detailing per project</practical-name> <line-item type="integer">27</line-item> <note-a>Please see the attached Schedule A for the detailed break-down</note-a> <note-b>This item is non-returnable</note-b> <order-item-applied-taxes type="array"> <order-item-applied-tax> <tax-id type="integer">291</tax-id> <amount type="decimal">3769.25</amount> <description>LineItemValue x HST</description> </order-item-applied-tax> <order-item-applied-tax> <tax-id type="integer">390</tax-id> <amount type="decimal">1570.52</amount> <description>LineItemValue x GST</description> </order-item-applied-tax> </order-item-applied-taxes> <order-item-adjustments type="array"> <order-item-adjustment> <adjustment-type-id type="integer">289</adjustment-type-id> <percentage type="decimal">-10.0</percentage> <amount nil="true"></amount> <adjustment-type> <name>Discount</name> </adjustment-type> </order-item-adjustment> </order-item-adjustments> </order-item> </order-items>
Delete an Order Item on Order id 2040:
$ curl -X DELETE -i --header "VERSACCOUNTS_AUTHORIZATION:494d60c5b140f1900e04256eca0d599cc0214fcf" https://www10.versaccounts.com/v1/order/2040/order_item/7589
Response:
OrderItem destroyed
Update an order item
$ curl -i -X PUT \
https://www10.versaccounts.com/v1/order/280530/order_item/933976.json \
-H 'Content-Type: application/json' \
-H 'VERSACCOUNTS_AUTHORIZATION:494d60c5b140f1900e04256eca0d599cc0214fcf' \
-H 'cache-control: no-cache' \
-d '{"order_item": { "quantity": "3", "per_unit_cost": "20"}}'
Response:
The order item in json/xml format.
Comments and Suggestions
0 comments
Please sign in to leave a comment.
Related articles