1. Order fulfillment

Viewing incoming orders

Learn how to view incoming buyer orders in the seller perspective and how to filter these results by order status.

Now that you have submitted your first order as a buyer user, see how an admin user can view that same order and take action on it like completing it. Doing so requires changing to the seller perspective.

Use the access token in the response for the remainder of this section.

http
POST https://sandboxapi.ordercloud.io/oauth/token
Content-Type: application/json

{
  "client_id": "INSERT_SHARED_API_CLIENT_ID",
  "grant_type": "password",
  "username": "admin01",
  "password": "INSERT_ADMIN_USER_PASSWORD",
  "scope": "OrderAdmin"
}

Now that we are operating under a seller perspective, interacting with orders has changed. In previous guides we covered order direction and so far have been using Outgoing. Looking at the flow:

Buyer ➔ Seller

We can see that the order should now be Incoming. List incoming orders, and specifically filter by status "Open" which includes all orders that have been submitted but not yet completed.

http
GET https://sandboxapi.ordercloud.io/v1/orders/incoming?Status=Open HTTP/1.1
Authorization: Bearer INSERT_ACCESS_TOKEN_HERE
Content-Type: application/json; charset=UTF-8

The response looks like this:

json
{
  "Meta": {
    "Page": 1,
    "PageSize": 20,
    "TotalCount": 1,
    "TotalPages": 1,
    "ItemRange": [
      1,
      1
    ]
  },
  "Items": [
    {
      "ID": "PKTiEFNEiEi9mEmC9cZCrw",
      "FromUser": {
        "ID": "BUYER_USER",
        "Username": "buyer01",
        "Password": null,
        "FirstName": "Buyer",
        "LastName": "User",
        "Email": "[email protected]",
        "Phone": null,
        "TermsAccepted": null,
        "Active": true,
        "xp": null,
        "AvailableRoles": null,
        "Locale": null,
        "DateCreated": "2021-02-08T23:09:14.82+00:00",
        "PasswordLastSetDate": "2021-02-08T23:10:00.56+00:00"
      },
      "FromCompanyID": "BUYER_ORGANIZATION",
      "ToCompanyID": "xxxxxxxxxxxxx",
      "FromUserID": "BUYER_USER",
      "BillingAddressID": null,
      "BillingAddress": null,
      "ShippingAddressID": null,
      "Comments": null,
      "LineItemCount": 1,
      "Status": "Open",
      "DateCreated": "2021-02-23T20:39:03.173+00:00",
      "DateSubmitted": "2021-03-01T22:37:59.267+00:00",
      "DateApproved": null,
      "DateDeclined": null,
      "DateCanceled": null,
      "DateCompleted": null,
      "Subtotal": 20,
      "ShippingCost": 0,
      "TaxCost": 0,
      "PromotionDiscount": 0,
      "Currency": null,
      "Total": 20,
      "IsSubmitted": true,
      "LineItems": null,
      "xp": null
    }
  ]
}

Note the Order ID in this response, as you will need it in the next guide.

If you have suggestions for improving this article, let us know!