All Release Notes

Orders available in the GraphQL schema

2 January 2019
Enhancement
GraphQLOrders

You can now access orders and related information using the GraphQL schema.

  • [GraphQL API] Added the following types to the GraphQL schema: CustomLineItemReturnItem, LineItemReturnItem, Order, OrderQueryResult, OrderState, PaymentState, ReturnInfo, ReturnItem, ReturnPaymentState, ReturnShipmentState, ShipmentState, SyncInfo.
  • [GraphQL API] Changed the Me type:
    • Added the orders field to the Me type
    • Added the order field to the Me type
  • [GraphQL API] Changed the Query type:
    • Added the orders field to the Query type
    • Added the order field to the Query type

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Me {
order(
"Queries with specified ID"
id: String, orderNumber: String): Order
orders(where: String, sort: [String!], limit: Int, offset: Int): OrderQueryResult!
}
extend type Query {
order(
"Queries with specified ID"
id: String, orderNumber: String): Order
orders(where: String, sort: [String!], limit: Int, offset: Int): OrderQueryResult!
}
type CustomLineItemReturnItem implements ReturnItem {
type: String!
customLineItemId: String!
id: String!
quantity: Long!
comment: String
shipmentState: ReturnShipmentState!
paymentState: ReturnPaymentState!
lastModifiedAt: DateTime!
createdAt: DateTime!
}
type LineItemReturnItem implements ReturnItem {
type: String!
lineItemId: String!
id: String!
quantity: Long!
comment: String
shipmentState: ReturnShipmentState!
paymentState: ReturnPaymentState!
lastModifiedAt: DateTime!
createdAt: DateTime!
}
"""
An order can be created from a cart, usually after a checkout process has been completed.
[documentation](/http-api-projects-orders.html)
"""
type Order implements Versioned {
customerId: String
customer: Customer
customerEmail: String
anonymousId: String
lineItems: [LineItem!]!
customLineItems: [CustomLineItem!]!
totalPrice: Money!
taxedPrice: TaxedPrice
shippingAddress: Address
billingAddress: Address
inventoryMode: InventoryMode!
taxMode: TaxMode!
taxRoundingMode: RoundingMode!
taxCalculationMode: TaxCalculationMode!
customerGroup: CustomerGroup
customerGroupRef: Reference
country: Country
shippingInfo: ShippingInfo
discountCodes: [DiscountCodeInfo!]!
refusedGifts: [CartDiscount!]!
refusedGiftsRefs: [Reference!]!
paymentInfo: PaymentInfo
locale: Locale
shippingRateInput: ShippingRateInput
origin: CartOrigin!
storeRef: KeyReference @deprecated(reason: "beta feature")
store: Store @deprecated(reason: "beta feature")
itemShippingAddresses: [Address!]!
completedAt: DateTime
orderNumber: String
orderState: OrderState!
stateRef: Reference
state: State
shipmentState: ShipmentState
paymentState: PaymentState
syncInfo: [SyncInfo!]!
returnInfo: [ReturnInfo!]!
lastMessageSequenceNumber: Long!
cartRef: Reference
cart: Cart
"This field contains non-typed data. Consider using `customFields` as a typed alternative."
customFieldsRaw(
"""
The names of the custom fields to include.
If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned.
"""
includeNames: [String!],
"""
The names of the custom fields to exclude.
If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned.
"""
excludeNames: [String!]): [RawCustomField!]
"This field would contain type data"
customFields: Type
id: String!
version: Long!
createdAt: DateTime!
lastModifiedAt: DateTime!
createdBy: Initiator
lastModifiedBy: Initiator
}
type OrderQueryResult {
offset: Int!
count: Int!
total: Long!
results: [Order!]!
}
enum OrderState {
Confirmed
Cancelled
Complete
Open
}
enum PaymentState {
Paid
CreditOwed
Pending
Failed
BalanceDue
}
"Stores information about returns connected to this order."
type ReturnInfo {
items: [ReturnItem!]!
returnTrackingId: String
returnDate: DateTime
}
interface ReturnItem {
type: String!
id: String!
quantity: Long!
comment: String
shipmentState: ReturnShipmentState!
paymentState: ReturnPaymentState!
lastModifiedAt: DateTime!
createdAt: DateTime!
}
enum ReturnPaymentState {
NotRefunded
Refunded
Initial
NonRefundable
}
enum ReturnShipmentState {
Unusable
BackInStock
Returned
Advised
}
enum ShipmentState {
Delayed
Backorder
Partial
Pending
Ready
Shipped
}
"Stores information about order synchronization activities (like export or import)."
type SyncInfo {
channelRef: Reference!
channel: Channel!
externalId: String
syncedAt: DateTime!
}