Query Templates

Modified on Thu, 14 Sep, 2023 at 2:17 PM

Introduction


This resource is meant to be used as a reference for various different supply data query examples with the Nexar API. Feel free to adapt any of these to suit your use case.


Find more in-depth examples in our Query Guides.


If you use Postman, you can find attached a collection containing many of these queries. Here's an article explaining how to import this into Postman: https://learning.postman.com/docs/getting-started/importing-and-exporting/importing-data/.


Whilst this is a handy resource to get started, we recommend that you learn how to build your own queries as that will help you to get the data you need most efficiently. documentation on how the language works and please check out our documentation on our data model.


Queries Contents


Queries


Query for attributes:

query attributes {
  supAttributes {
    id
    name
    unitsName
  }
}


Query for manufacturers:

query manufacturers {
    supManufacturers {
      id
      name
      isVerified
      homepageUrl
    }
}


Query for sellers:

query sellers {
  supSellers {
    id
    name
    isVerified
    homepageUrl
  }
}


Query for categories: 

query categories {
  supCategories {
    id
    name
    path
    numParts
  }
}

Query for a specific category:

query specificCategory {
  supCategories (ids: ["4161"]) {
    id
    name
    path
    numParts
    children {
      id
      parentId
      name
      path
      numParts
    }
  }
}


Query for parts by ID:

query partsById {
  supParts (ids: ["300", "100"], currency: "GBP"){
    id
    name
    mpn
    medianPrice1000 {
      quantity
      convertedPrice
      convertedCurrency
    }
    category {
      id
      name
    }
  }
}

Query for parts by MPN:

query partsByMpn {
  supSearchMpn (q: "acs770"){
    hits
    results {
      part {
        id
        name
        mpn
        medianPrice1000 {
          quantity
          convertedPrice
          convertedCurrency
        }
        category {
          id
          name
        }
      }
    }
  }
}


Query for parts by SKU:

query exactSku {
  supMultiMatch (queries: [{sku: "SY55855VKG", limit: 1}]) {
    hits
    parts {
      id
      mpn
      name
      sellers {
        company {
          id
          name
        }
        offers {
          id
          sku
        }
      }
    }
  }
}


Query for parts by manufacturer ID:

query partsByManufacturer {
    supSearch (filters: {manufacturer_id: ["11810"]}){
        hits
        results {
            part {
                id
                name
                mpn
                manufacturer {
                    id
                    name
                }
                totalAvail
                sellers (
                    authorizedOnly: true
                ){
                    company {
                        name
                    }
                    offers {
                        inventoryLevel
                    }
                }
            }
        }
    }
}


Query for technical specifications by part:

query specsByPart {
  supSearchMpn (q: "acs770"){
    results {
      part {
        id
        name
        mpn
        specs {
          value
          unitsName
          unitsSymbol
        }
      }
    }
  }
}


Query for searching by description:

query search {
  supSearch (q: "Current sensor") {
    hits
    results {
      part {
        id
        name
        shortDescription
      }
    }
  }
}

Query for parts for multiple MPNs:

query multipleMpns {
  supMultiMatch (queries: [{mpn: "SY89832UMG"}, {mpn: "SY89874UMG"}]) {
    hits
    parts {
      id
      name
      mpn
      category {
        id
        name
      }
    }
  }
}

Query for offers in a specified currency:

query specifiedCurrency {
  supSearchMpn (q: "acs770", currency: "GBP") {
    hits
    results {
      part {
        id
        name
        mpn
        sellers {
          company {
            name
            isVerified
          }
          offers {
            id
            inventoryLevel
            moq
            prices {
              quantity
              convertedPrice
              convertedCurrency
            }
          }
        }
      }
    }
  }
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article