Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Search parts in APIv4 based on string of description #6

Open
vivienwwp opened this issue Aug 11, 2021 · 2 comments
Open

Search parts in APIv4 based on string of description #6

vivienwwp opened this issue Aug 11, 2021 · 2 comments

Comments

@vivienwwp
Copy link

vivienwwp commented Aug 11, 2021

Hi,

I am wondering if anyone has tried on APIv4 to do a search similar to what the Octopart playground has done on searching for parts based on some description:

This is an example on Playground and I am hoping to have similar code in the APIv4 that does this.
Would it be PartsMatchQuery?

query {

search(q: "1k 0603 1W", limit: 2) {
results {
part {
mpn
manufacturer {
name
}

  }
}

}
}

@vivienwwp
Copy link
Author

Eventually I want it to return a list of parts based on the limit i have set

@RobAltium
Copy link
Collaborator

RobAltium commented Aug 26, 2021

Hi @vivienwwp - the search query API performs a search and returns zero or more parts. There's also the search_mpn which is like search but looks only for the input query string in the MPNs.

The type you quote, PartsMatchQuery, is an input for a different query, multi_match. This performs a match (based on MPN, SKU or MPN_or_SKU) rather than a search.

You can read more on the search behavior on the Octopart documentation here:

https://octopart.com/api/v4/reference
https://octopart.com/faq/how-to-search-on-octopart

The Octopart Excel add-in used matching under the hood rather than searching. Have you tried the new Nexar Excel add-in?

https://github.com/NexarDeveloper/nexar-supply-excel-cs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants