How to minimize requests to the ShipperHQ API

Overview

ShipperHQ tracks the amount of API requests made for an account to ensure accounts stay within their plan limits. When an account consistently exceeds these plan limits, we do not limit or block access to the API, but we do reach out to discuss and seek a resolution. This document helps users understand the number of requests they are sending, and how to keep unnecessary requests to a minimum.

How many requests is my account making?

We have a few tools to help users understand how many requests their account is making to the API:

  • The Analytics page within the ShipperHQ Dashboard provides a breakdown of the number of requests for the account. You can use it to track your API usage over time.
  • The ShipperHQ Logger comes with the ShipperHQ Magento 2 extension. It logs each request made to the API, and provides some additional relevant information. You can use it to see how many requests are being made while stepping through the order process.

Which log entries indicate an API request?

We request new estimates when the shipment details such as destination address or cart contents change. The requests made to ShipperHQ’s API generate a Transaction ID and you can view the Magento logs to see how many are generated while stepping through checkout. These are the following log requests:

  • Rate request and result – These logs have a unique Transaction ID representing a request to the ShipperHQ API that count towards the account’s request limit, with the following notable exceptions:
    • Found Cached Rates in Magento Cache For This Cart – Not Requesting Rates From ShipperHQ – There is one “Rate request and result” log per such estimate, but this also appears if a previously cached rate is reused, in which case, no request is sent to the API. When a cached rate is reused, this is indicated by this message in the logs.
    • Ignoring rate request – Configuration settings are to ignore requests as zipcode is empty – Per core Magento checkout behavior, Magento runs estimate-shipping-methods each time the address is updated while filling in details.
Please remember to turn the logger off; it does not need to be constantly running. Obtaining your shipping rates slows down expoentially if the logger is turned on.

How to reduce unnecessary API requests?

You can prevent ShipperHQ extension from making any calls to our API before the Zipcode is entered by ensuring the setting “Require Zipcode To Request Rates” is enabled (which it is by default).

This will involve navigating within your Magento 2 Admin Panel under Stores > Configuration > Sales > Shipping Methods > ShipperHQ > Advanced Settings. Change the “Require Meaningful Address To Request Rates” setting from “Yes” to “No.” Then, save the config to apply the change.

This feature will help to significantly reduce the quantity of redundant API calls made.

Was this doc helpful?