Retry issue with GraphQL

I asked Portable.io to see if they could build a custom connector based on ShipHero’s API, but they ran into some snags.

They mentioned the API doesn’t return 429 error codes. So a potential ETL process could silently fail / stop an extract before data is complete if we accidentally hit the limit.

Does ShipHero have any advice on how to handle the aforementioned retry issue?

Hey @cschouten,

Thanks for reaching out and welcome to our Developer Community Site!
I’ll start looking into this matter and get back to you.

Please let me know if you have any questions or concerns in the meantime.

Best,
RayanP

Hey Team,

Thanks for hanging in there.

I believe a 429 has something to do with throttling. In all of the responses we send the details regarding credits expended and credits remaining to try and help with that.

I can try to help optimize the queries and mutations are being ran, if you’d like to send the request ids for me to look into.

Please let me know if you have any questions or concerns.
Best,
RayanP

Thanks @sh-agent!

To clarify, should I post those queries here, or would it be okay to email ShipHero?

Cheers,
Colin

Hey @cschouten,

You can go ahead and post them here. I’ll be happy to review them and try to help, best I can.

Please let me know if you have any questions or concerns!

Best,
RayanP

Good stuff. This Orders query is written in Java. Let me know if you need me to add additional color/context to this query, @sh-agent. Thanks again for taking a look.

static final String DATE_FROM_PLACEHOLDER = "'date_from'";
static final String NEXT_PAGE_PLACEHOLDER = "'next_page'";
static final String ID_PLACEHOLDER = "'id'";
static final String INDEX_PLACEHOLDER = "'index'";

    private static final String ORDER_COMMON =
            "      id" +
            "      legacy_id" +
            "      order_number" +
            "      partner_order_id" +
            "      shop_name" +
            "      fulfillment_status" +
            "      order_date" +
            "      total_tax" +
            "      subtotal" +
            "      total_discounts" +
            "      total_price" +
            "      auto_print_return_label" +
            "      custom_invoice_url" +
            "      account_id" +
            "      email" +
            "      profile" +
            "      packing_note" +
            "      required_ship_date" +
            "      flagged" +
            "      saturday_delivery" +
            "      ignore_address_validation_errors" +
            "      priority_flag" +
            "      source" +
            "      third_party_shipper {" +
            "        zip" +
            "        account_number" +
            "        country" +
            "      }" +
            "      gift_invoice" +
            "      order_history {" +
            "        created_at" +
            "        information" +
            "        user_id" +
            "      }" +
            "      allow_partial" +
            "      require_signature" +
            "      adult_signature_required" +
            "      alcohol" +
            "      expected_weight_in_oz" +
            "      insurance" +
            "      insurance_amount" +
            "      currency" +
            "      has_dry_ice" +
            "      allocation_priority" +
            "      allow_split" +
            "      ready_to_ship" +
            "      holds {" +
            "        address_hold" +
            "        fraud_hold" +
            "        payment_hold" +
            "        shipping_method_hold" +
            "        operator_hold" +
            "        client_hold" +
            "      }" +
            "      line_items(first: 5" + NEXT_PAGE_PLACEHOLDER + ") {" +
            "        pageInfo {" +
            "          hasNextPage" +
            "          endCursor" +
            "        }" +
            "        edges {" +
            "          node {" +
            "            id" +
            "            sku" +
            "            quantity" +
            "            quantity_allocated" +
            "            quantity_pending_fulfillment" +
            "            fulfillment_status" +
            "            backorder_quantity" +
            "            promotion_discount" +
            "          }" +
            "        }" +
            "      }";

    static final String ORDER =
            "{" +
            "  order (id: \"" + ID_PLACEHOLDER + "\") {" +
            "    data {" +
                   ORDER_COMMON.replace("first: 5", "first: 50") +
            "    }" +
            "  }" +
            "}";

    static final String ORDERS =
            "{" +
            "  orders (updated_from: \"" + DATE_FROM_PLACEHOLDER + "\") {" +
            "    data(first: 10" + NEXT_PAGE_PLACEHOLDER + ") {" +
            "      pageInfo {" +
            "        hasNextPage" +
            "        endCursor" +
            "      }" +
            "      edges {" +
            "        node {" +
                       ORDER_COMMON +
            "        }" +
            "      }" +
            "    }" +
            "  }" +
            "}";

Hey @cschouten,

I’m not super well versed with Java so I’ll have to research this one a bit more. I did notice this line here
"ORDER_COMMON.replace("first: 5", "first: 50")". I’d recommend lowering that value of 50, and using pagination more there. I’ll be looking into this some more!

Please let me know if you have any questions or concerns.

Best,
RayanP