MyCloud Logo

MyCloud API Documentation

Order Model

The Order model represents an order placed with your shop. Orders consist of OrderItems, which are the Products that are attached to the order. An order can have a Customer attached to it, but this is not required. And order must have a DeliveryMode attached to it to select the method of shipment. The payment attributes are provided for the customer to indicate to the shop when and how payment was made so the shop can verify payment. If payment was received through an online payment system, the shop may store that information in the order if they want.

RESTful Calls

Get All Orders

GET/orders

Get all Orders associated with your account. Note, your account may contain many orders, and retrieving all of them in one call puts an excessive load on the server, as well as requiring a long time to reply. This will typically result in your request timing out. Thus, is it recommended that you use the 'offset' and 'count' parameters to <em>paginate</em> getting all orders. Setup a loop and start with offset 0, and a count that is reasonable (e.g. 20), then increment offset by count for each loop iteration. This request will return only <em>undeleted</em> orders. If you want to rerieve deleted orders as well, setup the <em>deleted</em> parameter.

Request Parameters

This request has no parameters.

Response

Name
Type
Example
Description
orders
order[]
The list of Orders requested according to the pagination and deleted parameters.
order
Object
 
A order object.
id
integer
342
The database key.
mc_number
string
MC180408932
The unique MyCloud identifier.
customer
Object
 
A customer object.
id
integer
342
The database key.
code
string
CU0034
The code assigned to the customer by the shop.
name
string
คุณ พวริด
The name of the customer.
phone_number
string
0899969094
The phone number of the customer.
email
string
customer@domain.com
The email address of the customer.
social_id
string
MyLineId
This is a social media id for the customer (e.g. Facebook ID or Line ID
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the customer.
postcode
string
10260
The postcode of the customer.
note
string
This is a special order.
A text note provided for this customer.
deliverymode
Object
 
A deliverymode object.
id
integer
342
This is the delivery mode's database key.
code
integer
MA002
This is the delivery mode's MyCloud internal identity code.
name
string
Kerry Express
This is the delivery mode's name.
contact
string
contact@kerry-express.com
Contact url or information for delivery mode provider.
billing_title
string
Order #BD-0023
The billing title of this order.
customer_ref
string
CREF-20180304-A001
The customer assigned reference for this order.
order_number
string
ORD-004564014
The customer assigned order number of this order.
create_date
Date
2017-12-31
The date the order was created in the format of YYYY-mm-dd.
delivery_date
Date
2017-12-31
The date the order was delivered in the format of YYYY-mm-dd.
name
string
คุณ พวริด
The name of the order recipient.
phone_number
string
0899969094
The phone number of the order recipient.
email
string
customer@domain.com
The email address of the order recipient.
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the order recipient.
postcode
string
10260
The postcode of the order recipient.
note
string
This is a special order.
A text note provided for this order.
total_price
integer
899
The total price for the order in THB.
payment_amount
integer
899
The amount the customer claims to have paid in THB.
payment_date
Date
2017-12-31
The date the customer claims to have made payment in the format of YYYY-mm-dd.
payment_time
Time
15:32
The time the customer claims to have made payment in the format of HH:MM (HH is 00 to 23)
weight
float
0.453
The total weight of the order being shipped in Kg.
urgent
boolean
false
If true, the order is considered urgent.

Get Order

GET/orders/{id}

Get an order by it's ID.

Request Parameters

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

Response

Name
Type
Example
Description
order
Object
 
A order object.
id
integer
342
The database key.
mc_number
string
MC180408932
The unique MyCloud identifier.
customer
Object
 
A customer object.
id
integer
342
The database key.
code
string
CU0034
The code assigned to the customer by the shop.
name
string
คุณ พวริด
The name of the customer.
phone_number
string
0899969094
The phone number of the customer.
email
string
customer@domain.com
The email address of the customer.
social_id
string
MyLineId
This is a social media id for the customer (e.g. Facebook ID or Line ID
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the customer.
postcode
string
10260
The postcode of the customer.
note
string
This is a special order.
A text note provided for this customer.
deliverymode
Object
 
A deliverymode object.
id
integer
342
This is the delivery mode's database key.
code
integer
MA002
This is the delivery mode's MyCloud internal identity code.
name
string
Kerry Express
This is the delivery mode's name.
contact
string
contact@kerry-express.com
Contact url or information for delivery mode provider.
billing_title
string
Order #BD-0023
The billing title of this order.
customer_ref
string
CREF-20180304-A001
The customer assigned reference for this order.
order_number
string
ORD-004564014
The customer assigned order number of this order.
create_date
Date
2017-12-31
The date the order was created in the format of YYYY-mm-dd.
delivery_date
Date
2017-12-31
The date the order was delivered in the format of YYYY-mm-dd.
name
string
คุณ พวริด
The name of the order recipient.
phone_number
string
0899969094
The phone number of the order recipient.
email
string
customer@domain.com
The email address of the order recipient.
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the order recipient.
postcode
string
10260
The postcode of the order recipient.
note
string
This is a special order.
A text note provided for this order.
total_price
integer
899
The total price for the order in THB.
payment_amount
integer
899
The amount the customer claims to have paid in THB.
payment_date
Date
2017-12-31
The date the customer claims to have made payment in the format of YYYY-mm-dd.
payment_time
Time
15:32
The time the customer claims to have made payment in the format of HH:MM (HH is 00 to 23)
weight
float
0.453
The total weight of the order being shipped in Kg.
urgent
boolean
false
If true, the order is considered urgent.

Get Order Items

GET/orders/{id}/orderitems

Get all order items for an order specified by id.

Request Parameters

Parameter
Type
Required
Example
Description
id
integer
Yes
1984
The DB key for the order to retrieve the order items for.

Response

Name
Type
Example
Description
orderitems
orderitem[]
The order items attached to the order identified by {id}.
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.

Create Order

POST/orders

Create a new order with the specified order items, delivery mode, and possible customer.

Request Parameters

Parameter
Type
Required
Example
Description
customer_id
integer
No
232
The DB key for the customer to attach to this order, or 0.
delivery_mode_id
integer
Yes
343
The DB key for the delivery mode to be used to ship this order.
order_items[]
array
Yes
The list of order items for this order. Each order item must be specified as an array of values, similar to HTML
parameters.
order_items[index][product_id]
mixed
Yes
The product identifier for this order item. Product identifiers can be one of three possible ids:
  • product_id - integer
  • product_sku - string
  • shop_sku - string
For example, it the first order item identifies it's product by a DB key, you would use 'order_items[0][product_id]'. To identify the second order item's product by it's shop_sku, you would use 'order_items[1][shop_sku]'.
order_items[index][quantity]
integer
Yes
2
The quantity of this product for this order item.
order_items[index][price]
double
Yes
199.00
The price of this product for this order item.
attach_name[index]
string
No
LABEL
Attaching files to an order requires to separate parameters - the attachment name (this parameter) and the attachment file. NOTE that attachment names are included in the standard parameters, while the files are included in additional sections of the multi-part form (please refer to the RFC if your library does not support this directly)
attach_file[index]
file
No
Attached files must be included in separate sections of your multipart form data. Note that the attachment name and file will be connected by the index of the parameters.

Response

Name
Type
Example
Description
order
Object
 
A order object.
id
integer
342
The database key.
mc_number
string
MC180408932
The unique MyCloud identifier.
customer
Object
 
A customer object.
id
integer
342
The database key.
code
string
CU0034
The code assigned to the customer by the shop.
name
string
คุณ พวริด
The name of the customer.
phone_number
string
0899969094
The phone number of the customer.
email
string
customer@domain.com
The email address of the customer.
social_id
string
MyLineId
This is a social media id for the customer (e.g. Facebook ID or Line ID
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the customer.
postcode
string
10260
The postcode of the customer.
note
string
This is a special order.
A text note provided for this customer.
deliverymode
Object
 
A deliverymode object.
id
integer
342
This is the delivery mode's database key.
code
integer
MA002
This is the delivery mode's MyCloud internal identity code.
name
string
Kerry Express
This is the delivery mode's name.
contact
string
contact@kerry-express.com
Contact url or information for delivery mode provider.
billing_title
string
Order #BD-0023
The billing title of this order.
customer_ref
string
CREF-20180304-A001
The customer assigned reference for this order.
order_number
string
ORD-004564014
The customer assigned order number of this order.
create_date
Date
2017-12-31
The date the order was created in the format of YYYY-mm-dd.
delivery_date
Date
2017-12-31
The date the order was delivered in the format of YYYY-mm-dd.
name
string
คุณ พวริด
The name of the order recipient.
phone_number
string
0899969094
The phone number of the order recipient.
email
string
customer@domain.com
The email address of the order recipient.
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the order recipient.
postcode
string
10260
The postcode of the order recipient.
note
string
This is a special order.
A text note provided for this order.
total_price
integer
899
The total price for the order in THB.
payment_amount
integer
899
The amount the customer claims to have paid in THB.
payment_date
Date
2017-12-31
The date the customer claims to have made payment in the format of YYYY-mm-dd.
payment_time
Time
15:32
The time the customer claims to have made payment in the format of HH:MM (HH is 00 to 23)
weight
float
0.453
The total weight of the order being shipped in Kg.
urgent
boolean
false
If true, the order is considered urgent.

Update Order

PATCH/orders/{order_id}

Update an existing order with the specified order items, delivery mode, and possible customer. Only the parameters specified will be updated. If order items are provided, those matching existing attached order items will update only the price and/or quantity. Order items not matching existing attached order items will attach new order items to the order.

Request Parameters

Parameter
Type
Required
Example
Description
customer_id
integer
No
232
The DB key for the customer to attach to this order, or 0.
delivery_mode_id
integer
No
343
The DB key for the delivery mode to be used to ship this order.
order_items[]
array
No
The list of order items for this order. Each order item must be specified as an array of values, similar to HTML parameters.
order_items[index][product_id]
mixed
No
The product identifier for this order item. Product identifiers can be one of three possible ids:
  • product_id - integer
  • product_sku - string
  • shop_sku - string
For example, it the first order item identifies it's product by a DB key, you would use 'order_items[0][product_id]'. To identify the second order item's product by it's shop_sku, you would use 'order_items[1][shop_sku]'. Order items matching existing attached order items will update the quantity and price of that order item. Order items not matching existing order items will cause a new order item to be attached to the order.
order_items[index][quantity]
integer
Yes
2
The quantity of this product for this order item.
order_items[index][price]
double
Yes
199.00
The price of this product for this order item.
attach_name[index]
string
No
LABEL
Attaching files to an order requires to separate parameters - the attachment name (this parameter) and the attachment file. NOTE that attachment names are included in the standard parameters, while the files are included in additional sections of the multi-part form (please refer to the RFC if your library does not support this directly). NOTE that an attachment with the same name as an existing attachment will replace the attached file with the newly uploaded file.
attach_file[index]
file
No
Attached files must be included in separate sections of your multipart form data. Note that the attachment name and file will be connected by the index of the parameters.

Response

Name
Type
Example
Description
order
Object
 
A order object.
id
integer
342
The database key.
mc_number
string
MC180408932
The unique MyCloud identifier.
customer
Object
 
A customer object.
id
integer
342
The database key.
code
string
CU0034
The code assigned to the customer by the shop.
name
string
คุณ พวริด
The name of the customer.
phone_number
string
0899969094
The phone number of the customer.
email
string
customer@domain.com
The email address of the customer.
social_id
string
MyLineId
This is a social media id for the customer (e.g. Facebook ID or Line ID
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the customer.
postcode
string
10260
The postcode of the customer.
note
string
This is a special order.
A text note provided for this customer.
deliverymode
Object
 
A deliverymode object.
id
integer
342
This is the delivery mode's database key.
code
integer
MA002
This is the delivery mode's MyCloud internal identity code.
name
string
Kerry Express
This is the delivery mode's name.
contact
string
contact@kerry-express.com
Contact url or information for delivery mode provider.
billing_title
string
Order #BD-0023
The billing title of this order.
customer_ref
string
CREF-20180304-A001
The customer assigned reference for this order.
order_number
string
ORD-004564014
The customer assigned order number of this order.
create_date
Date
2017-12-31
The date the order was created in the format of YYYY-mm-dd.
delivery_date
Date
2017-12-31
The date the order was delivered in the format of YYYY-mm-dd.
name
string
คุณ พวริด
The name of the order recipient.
phone_number
string
0899969094
The phone number of the order recipient.
email
string
customer@domain.com
The email address of the order recipient.
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the order recipient.
postcode
string
10260
The postcode of the order recipient.
note
string
This is a special order.
A text note provided for this order.
total_price
integer
899
The total price for the order in THB.
payment_amount
integer
899
The amount the customer claims to have paid in THB.
payment_date
Date
2017-12-31
The date the customer claims to have made payment in the format of YYYY-mm-dd.
payment_time
Time
15:32
The time the customer claims to have made payment in the format of HH:MM (HH is 00 to 23)
weight
float
0.453
The total weight of the order being shipped in Kg.
urgent
boolean
false
If true, the order is considered urgent.

Delete Order

DELETE/orders/{order_id}

Delete an existing order.

Request Parameters

This request has no parameters.

Response

Name
Type
Example
Description
order
Object
 
A order object.
id
integer
342
The database key.
mc_number
string
MC180408932
The unique MyCloud identifier.
customer
Object
 
A customer object.
id
integer
342
The database key.
code
string
CU0034
The code assigned to the customer by the shop.
name
string
คุณ พวริด
The name of the customer.
phone_number
string
0899969094
The phone number of the customer.
email
string
customer@domain.com
The email address of the customer.
social_id
string
MyLineId
This is a social media id for the customer (e.g. Facebook ID or Line ID
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the customer.
postcode
string
10260
The postcode of the customer.
note
string
This is a special order.
A text note provided for this customer.
deliverymode
Object
 
A deliverymode object.
id
integer
342
This is the delivery mode's database key.
code
integer
MA002
This is the delivery mode's MyCloud internal identity code.
name
string
Kerry Express
This is the delivery mode's name.
contact
string
contact@kerry-express.com
Contact url or information for delivery mode provider.
billing_title
string
Order #BD-0023
The billing title of this order.
customer_ref
string
CREF-20180304-A001
The customer assigned reference for this order.
order_number
string
ORD-004564014
The customer assigned order number of this order.
create_date
Date
2017-12-31
The date the order was created in the format of YYYY-mm-dd.
delivery_date
Date
2017-12-31
The date the order was delivered in the format of YYYY-mm-dd.
name
string
คุณ พวริด
The name of the order recipient.
phone_number
string
0899969094
The phone number of the order recipient.
email
string
customer@domain.com
The email address of the order recipient.
address
string
32/1 สุขุมวิท 62, กรุงเทพฯ
The physical address of the order recipient.
postcode
string
10260
The postcode of the order recipient.
note
string
This is a special order.
A text note provided for this order.
total_price
integer
899
The total price for the order in THB.
payment_amount
integer
899
The amount the customer claims to have paid in THB.
payment_date
Date
2017-12-31
The date the customer claims to have made payment in the format of YYYY-mm-dd.
payment_time
Time
15:32
The time the customer claims to have made payment in the format of HH:MM (HH is 00 to 23)
weight
float
0.453
The total weight of the order being shipped in Kg.
urgent
boolean
false
If true, the order is considered urgent.