Endpoint to check order status via API

I need an endpoint that returns the status of an order, providing the order ID, to receive information in the response such as order delivered, in separation, etc.

Is it possible to do this via API?

order - GraphQL Admin

1 Like

Yes, you can consume the GraphQL API. It’s possible to combine the queries for orders and fulfillments into a single query. sharing sample you can modify according to the usecase.

{
  orders(first: 5) {
    edges {
      node {
        id
        name
        createdAt
        status
        fulfillments(first: 1) {
          edges {
            node {
              id
              status
              createdAt
            }
          }
        }
      }
    }
  }
}

1 Like

@tintin is on point here! Just adding a bit more context, if you’re wanting to check if the order has been fulfilled, the fulfillment status is what you’d want to look at, but to confirm it has been delivered, you’d want to use a query like this for example (fixing a bit of the example syntax as well):

{
  orders(first: 50 reverse:true) {
    edges {
      node {
        id
        name
        createdAt
        fulfillments(first: 1) {
          id
          status
          createdAt
          events(first: 10) {
            nodes {
              id
              status
            }
          }
        }
      }
    }
  }
}

Fulfillment Events can give you a bit more granular info from the Fulfillment Service if they support using them (specific delivery event info like attempted delivery, etc.):

Hope this helps!