Developer Resources > Examples

Gotcha’s

 

In this section, we share tips on how to troubleshoot common errors about:

Making Query Connections:

When querying for connection fields, if no first or last parameter is specified, a default of first: 100 is assumed.

Cannot request more than 100 items per connection field.

For example, a query like the following:

query {
  purchase_orders {
    request_id
    complexity
    data {
      edges {
        node {
          id
          line_items {
            edges {
              node {
                sku
              }
            }
          }
        }
      }
    }
  }
}

Has a connection for line_items inside purchase_ordes, so this means that if we don’t specify line_items(first:10) and purchase_orders(first:10) the complexity would be of 10001 (100 purchase_orders * 100 line_items each + 1 ), even if the PO does not have 100 line items or 100 purchase orders.

Client IDE not connecting:

A common error you might be having when trying to view de Docs & Schema using any of our recomended Client IDEs is not being able to access the docs.

For this purpose, we have a couple of suggestions:

  1. Using the Desktop Versions or Extensions of this Client IDEs. Usually, Web versions of these clients tend to have this kind of issue.
  2. Disabling cache on the Client IDE*

*you can do this by opening dev tools from inside the Client IDE and selecting Disable cache

Dates:

All dates are stored as UTC

ISODateTime: A DateTime field type that understand ISO 8601 strings, besides datetime objects. It supports strings with and without times, as well as using T or space as delimiter

Ex.

  • YYYY-mm-dd
  • YYYY-mm-dd HH:MM:SS
  • YYYY-mm-ddTHH:MM:SS

Dimensions:

Input dimensions are considered to be in the account’s settings unit, unless specified by the field name like weight_in_lbs
Output dimensions will always be in the account’s settings unit, unless specified by the field name like weight_in_lbs

Sell Ahead:

The sell_ahead field inside warehouse_products has a default cost of 15.

The reason for this is that complex calculations are required to figure out the sell_ahead quantities, as we need to check into existing POs to fetch these values.

Order History:

The order_history connection inside order has a default cost of 10.

This is because it returns every entry of the order history, no matter how many lines it has, without the need to paginate, as it is not an edge.

Custom options:

The available field inside line_items, called custom_options should have the following format:

custom_options: {key1:"value1", key2:"value2"}

So for example if you are trying to create an order using this field with order_create or order_add_line_items, the line items section should look something like this:

line_items: [
  {
    partner_line_item_id: "TEST-EN-8550-1A"
    sku: "3004022005228"
    quantity: 1
    price: "14.99"
    product_name: "Test product name"
    custom_options: {
      key1: "foo",
      key2: "bar",
      key3: "baz"
    }
  }
]

However, if you use the order_update_line_items mutation to update the custom_options field, you need to type in all of the existing keys, not just those you need to update. The mutation clears all that exists in the field and pastes only what was sent in it.

For example, if you only want to update key3 in the above line item, you should send the following:

line_items: [
  {
    id: "4357356783"
    custom_options: {
      key1: "foo",
      key2: "bar",
      key3: "newvalue"
    }
  }
]

Country/State codes:

On the order_create mutation, for the shipping address you will see the following fields:

shipping_address: {
        address1: "2326 Street Dr"
        address2: ""
        city: "Fort Collins"
        company: ""
        country: "US"
        country_code: "US"
        email: "EXAMPLE@GMAIL.COM"
        first_name: "John"
        last_name: "Johnson"
        phone: "(970) 111-111"
        state: "CO"
        state_code: "CO"
        zip: "80528"
      }

Both country_code and state_code have been deprecated.
In order to create successfully the order, country has to be the valid country code, for example, “US”, and similar, the state has to be a valid state code such as “CO”