MyCloud Logo

MyCloud API Documentation

Order Item Model

The OrderItem model represents a product that is an item on an order for your shop. For each product that is part of an order, there will be an order item. In other words, order items connect products to orders. Furthermore, an order item also defines the quantity of the product being ordered, as well as the actual price the product is being sold for on that order.

Using OrderItems can be a little confusing at first. You need to understand that OrderItems attached to an Order that you have retrieved from the API are complete objects and have all of their fields setup properly, including a complete Product object. On the other hand, when you are creating a new order, or updating an existing order, the OrderItem does not need a complete Product object to function properly - it only needs the order item's id for updating the price or quantity, and it only needs a Product object with an id when creating a new order item. Please see the example code provided for more details.

NOTE You will note that there is no "OrderItem Create" route. Currently, if you wish to add an order item to an existing order, you must use the "Order Update" route, passing only the new order item as a parameter.

RESTful Calls

Get Order Item

GET/orderitems/{id}

Get a specific order item by id.

Request Parameters

Parameter
Type
Required
Example
Description
id
integer
Yes
1984
The DB key for the delivery mode.

Response

Name
Type
Example
Description
orderitem
Object
 
A orderitem object.
id
integer
17839
This is the order item's database key.
price
integer
299
The price of the order item. This is used to set the specific price of this item for this order.
quantity
integer
1
The number of order items purchased in this order.

Update Order Item

PATCH/orderitems/{id}

Get a specific delivery mode by id.

Request Parameters

Parameter
Type
Required
Example
Description
id
integer
Yes
196179
The DB key for the order item.
price
double
Yes
199.00
The price for this order item.
quantity
integer
Yes
2
The number of this order item purchased in this order.

Response

Name
Type
Example
Description
orderitem
Object
 
A orderitem object.
id
integer
17839
This is the order item's database key.
price
integer
299
The price of the order item. This is used to set the specific price of this item for this order.
quantity
integer
1
The number of order items purchased in this order.

Delete Order Item

DELETE/order_item/{id}

Delete the order item identified by id from it's order.

Request Parameters

Parameter
Type
Required
Example
Description
id
integer
Yes
196179
The DB key for the order item.

Response

Name
Type
Example
Description
orderitem
Object
 
A orderitem object.
id
integer
17839
This is the order item's database key.
price
integer
299
The price of the order item. This is used to set the specific price of this item for this order.
quantity
integer
1
The number of order items purchased in this order.