GraphQL Sandbox Usage

Overview

**Please note** GraphQL Access is for customers on the ShipperHQ Enterprise Plan only. If you’d like to upgrade to the Enterprise Plan, please reach out here.

A sandbox/playground for testing GraphQL is available at graphiql-dev.shipperhq.com

Viewing Docs

Once you’ve entered an endpoint URL (SHQ’s url is entered by default) press the RELOAD button then click the DOCS button to show the available GraphQL queries

Preparing a query

Before writing a query the following Headers need to be entered. Click the headers button on the left which has a star shaped icon.

  • X-ShipperHQ-Access-Token – This is the API Key for a valid website in your SHQ account
  • X-ShipperHQ-Scope – This is the SCOPE from your SHQ account
  • X-ShipperHQ-Session – This identifies a cart/order, use any value

After the headers are entered you can type the QUERY you want to test then click the SEND REQUEST button. The results will display in the pane on the right.

Variables can be added by clicking the Variables button (icon of stacked boxes) on the left toolbar. The variables are entered in JSON format.

Example Queries

# 
# Fetches a basic quote
#
# If there are multiple shipments/warehouses they will be simplified
# into a single "merged" carrier. This makes this call suitable for use in
# platforms that expect a single shipping method per order
#

query RetrieveShippingQuote($ratingInfo: RatingInfoInput!) {
  retrieveShippingQuote(ratingInfo: $ratingInfo){
    transactionId
    carriers {
      carrierCode
      carrierTitle
      carrierType
      error {
        errorCode
        internalErrorMessage
        externalErrorMessage
        priority
      }
      shippingRates {
        code
        title
        totalCharges
      }
    }
    errors {
      errorCode
      internalErrorMessage
      externalErrorMessage
      priority
    }
  }
}
# 
# Fetches a detailed quote
#
# This query fetches a more detailed copy of the shipping rates
# it will show the full rate breakdown. Not all fields are included in this
# example, use the docs to see all available fields.
#


query RetrieveFullShippingQuote($ratingInfo: RatingInfoInput!) {
  retrieveFullShippingQuote(ratingInfo: $ratingInfo) {
    transactionId
    shipments {
      shipmentDetail {
        carrierGroupId
        name
      }
      carriers {
        carrierDetail {
          carrierCode
          carrierTitle
          carrierType
        }
        methods {
          methodDetails {
            methodCode
            methodTitle
            totalCharges
          }
        }
        error {
          errorCode
          internalErrorMessage
          externalErrorMessage
          priority
        }
      }
      groupedItems {
        itemId
      }
    }
    errors {
      errorCode
      internalErrorMessage
      externalErrorMessage
      priority
    }
  }
}