Developer Resources > Examples

Overview

Available operations:

The following processes will apply for both Fulfillment and Saas:

When it comes to specific Queries and Mutations, not all of them might be available for Fulfillment.

MUTATIONS:

The ones that will be available for Fulfillment accounts are the following:

  • Create Orders
  • Create Products
  • Create Shipping Plan

The rest of the mutations are available for Fulfillment, except for the ones specified next.

The ones that will not be available for Fulfillment accounts are the following:

  • Edit Shipping Plans (Purchase Orders)

  • Create / Edit Vendors

  • Inventory Sync

  • Inventory Add / Remove / Subtract / Replace

  • Location Create / Remove / Update

 

QUERIES:

Mostly all the queries are available for Fulfillment accounts. There are some specific queries for Fulfillment accounts that are

  • fulfillment_invoice
  •  fulfillment_invoices
  • shipping_plan

The ones that will not be available for Fulfillment accounts are the following:

Examples:

Mutations:

For most of the mutations available for the Fulfillment account, you can see some examples in our Examples section or also by inspecting the Schema & Docs.

The mutations specific to Fulfillment are the following:

  • shipping_plan_create

Shipping Plan Create

This Mutation will allow you to create a shipping plan

Mutation example:

mutation {
  shipping_plan_create(
    data: {
      subtotal: "0.00"
      shipping_price: "0.00"
      total_price: "0.00"
      warehouse_id: "13534"
      line_items: [
        { product_name: "Iron Man", sku: "0102", quantity: 10 }
        { product_name: "Black Panther", sku: "0103", quantity: 10 }
      ]
      pallet: {
        floor_loaded: false
        kind: "ltl"
        quantity: 2
        page_size: "letter"
      }
    }
  ) {
    complexity
    shipping_plan {
      id
      account_id
      fulfillment_status
      warehouse_id
      subtotal
      pdf_location
      line_items(first: 10) {
        edges {
          node {
            sku
            quantity
          }
        }
      }
      pallets(first: 10) {
        edges {
          node {
            kind
            quantity
            floor_loaded
            page_size
          }
        }
      }
    }
  }
}

Or you can also use packages instead of the pallet field:

mutation {
  shipping_plan_create(
    data: {
      subtotal: "0.00"
      shipping_price: "0.00"
      total_price: "0.00"
      warehouse_id: "13534"
      line_items: [
        { product_name: "Iron Man", sku: "0102", quantity: 10 }
        { product_name: "Black Panther", sku: "0103", quantity: 10 }
      ]
      packages: [
    {
        line_items: [
            {
                sku: "0102",
                quantity: 5
            },
            {
                sku: "0103",
                quantity: 5
            }
        ]
    },
    {
        line_items: [
            {
                sku: "0102",
                quantity: 5
            },
            {
                sku: "0103",
                quantity: 5
            }
        ]
    }
]
    }
  ) {
    complexity
    shipping_plan {
      id
      account_id
      fulfillment_status
      warehouse_id
      subtotal
      pdf_location
      line_items(first: 10) {
        edges {
          node {
            sku
            quantity
          }
        }
      }
      pallets(first: 10) {
        edges {
          node {
            kind
            quantity
            floor_loaded
            page_size
          }
        }
      }
    }
  }
}

 

Queries:

For most of the queries available for the Fulfillment account, you can see some examples in our Examples section or also by inspecting the Schema & Docs.

The queries specific to Fulfillment are the following:

  • fulfillment_invoice
  • fulfillment_invoices

Fulfillment Invoice

This query will allow you to get the Invoice details based on the Invoice ID

Query example:

query {
  fulfillment_invoice(id: "U0ZDaGFyZ2U6MQ==") {
    request_id
    complexity
    data {
      id
      legacy_id
      stripe_charge_id
      stripe_invoice_id
      stripe_invoice_number
      stripe_invoice_status
      stripe_invoice_url
      stripe_next_payment_attempt
      account_id
      cc_info
      amount
      created_at
      shipping_items(first: 1) {
        edges {
          node {
            id
            legacy_id
            account_id
            invoice_id
            order_id
            shipment_id
            shipping_label_id
            amount
            shipping_rate
            processing_fee
            picking_fee
            overcharge_fee
            created_at
          }
        }
      }
      inbound_shipping_items(first: 1) {
        edges {
          node {
            id
            legacy_id
            account_id
            invoice_id
            purchase_order_id
            shipment_id
            shipping_label_id
            amount
            cost
            created_at
          }
        }
      }
      returns_items(first: 1) {
        edges {
          node {
            id
            legacy_id
            account_id
            invoice_id
            order_id
            rma_id
            rma_label_id
            amount
            shipping_rate
            picking_fee
            inspection_fee
            restocking_fee
            created_at
          }
        }
      }
      storage_items(first: 1) {
        edges {
          node {
            id
            legacy_id
            account_id
            warehouse_id
            invoice_id
            amount
            created_at
          }
        }
      }
    }
  }
}

Fulfillment Invoices

This query will allow you to get the Invoices from a certain time range

query {
  fulfillment_invoices(date_from: "2019-06-26", date_to: "2019-06-27") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          id
          legacy_id
          stripe_charge_id
          stripe_invoice_id
          stripe_invoice_number
          stripe_invoice_status
          stripe_invoice_url
          stripe_next_payment_attempt
          account_id
          cc_info
          amount
          created_at
          shipping_items(first: 1) {
            edges {
              node {
                id
                legacy_id
                account_id
                invoice_id
                order_id
                shipment_id
                shipping_label_id
                amount
                shipping_rate
                processing_fee
                picking_fee
                overcharge_fee
                created_at
              }
            }
          }
          inbound_shipping_items(first: 1) {
            edges {
              node {
                id
                legacy_id
                account_id
                invoice_id
                purchase_order_id
                shipment_id
                shipping_label_id
                amount
                cost
                created_at
              }
            }
          }
          returns_items(first: 1) {
            edges {
              node {
                id
                legacy_id
                account_id
                invoice_id
                order_id
                rma_id
                rma_label_id
                amount
                shipping_rate
                picking_fee
                inspection_fee
                restocking_fee
                created_at
              }
            }
          }
          storage_items(first: 1) {
            edges {
              node {
                id
                legacy_id
                account_id
                warehouse_id
                invoice_id
                amount
                created_at
              }
            }
          }
        }
      }
    }
  }
}

Building an integration for a Fulfillment account:

When building an integration you might need to test several workflows to ensure that everything is working correctly.

Getting your account information:

  1. Use the account query to retrieve useful information such as warehouse_id. You will need this for some mutations

Example:

query {
  account {
    request_id
    complexity
    data {
      id
      legacy_id
      email
      warehouses {
        id
        legacy_id
        account_id
        identifier
        profile
      }
    }
  }
}

Creating products:

  1. Get the warehouse information with the account query
  2. Create a product using the product_create mutation

Creating an order:

  1. Use the order_create mutation to create an order