API-Octopart
view release on metacpan or search on metacpan
This is the max MOQ you will accept as being in
stock. For example, a 5000-part reel might be more
than you want for prototyping so set this to 10 or
100.
- seller => <regex> - Seller's name (regular expression)
This is a regular expression so something like
'Mouser|Digi-key' is valid.
- mfg => <regex> - Manufacturer name (regular expression)
Specifying the mfg name is useful if your part model
number is similar to those of other manufacturers.
- currency => <s> - eg, 'USD' for US dollars
Defaults to include all currencies
- $o->get\_part\_stock($part, %opts) - Returns a simple stock structure
$part, %opts: same as has\_stock().
Returns the following structure:
{
'Mouser' => {
'moq_price' => '0.2',
'moq' => 1,
'stock' => 24071
},
'Digi-Key' => {
'moq_price' => '0.2',
'moq' => 1,
'stock' => 10000
}
};
- $o->get\_part\_stock\_detail($part, %opts) - Returns a stock detail structure
$part, %opts: same as has\_stock().
Returns a structure like this:
[
{
'mfg' => 'Yageo',
'sellers' => {
'Digi-Key' => {
'moq' => 1,
'moq_price' => '0.1',
'price_tier' => {
'1' => '0.1',
'10' => '0.042',
'100' => '0.017',
'1000' => '0.00762',
'2500' => '0.00661',
'5000' => '0.00546'
},
'stock' => 4041192
},
...
},
'specs' => {
'case_package' => '0805',
'composition' => 'Thick Film',
'contactplating' => 'Tin',
'leadfree' => 'Lead Free',
'length' => '2mm',
'numberofpins' => '2',
'radiationhardening' => 'No',
'reachsvhc' => 'No SVHC',
'resistance' =>
"10k\x{ce}\x{a9}", # <- That is an Ohm symbol
'rohs' => 'Compliant',
'tolerance' => '1%',
'voltagerating_dc_' => '150V',
'width' => '1.25mm',
...
}
},
...
]
- $o->octo\_query($q) - Queries the Octopart API
Return the JSON response structure as a perl ARRAY/HASH given a query meeting Octopart's
API specification.
- $o->octo\_query\_count() - Return the number of API calls so far.
- $o->query\_part\_detail($part)
Return the JSON response structure as a perl ARRAY/HASH given a part search term
shown as "$part". This function calls $o->octo\_query() with a query from Octopart's
"Basic Example" so you can easily lookup a specific part number. The has\_stock()
and get\_part\_stock\_detail() methods use this query internally.
# SEE ALSO
[https://octopart.com/](https://octopart.com/), [https://octopart.com/api](https://octopart.com/api)
# ATTRIBUTION
Octopart is a registered trademark and brand of Octopart, Inc. All tradmarks,
product names, logos, and brands are property of their respective owners and no
grant or license is provided thereof.
The copyright below applies to this software module; the copyright holder is
unaffiliated with Octopart, Inc.
# AUTHOR
Originally written at eWheeler, Inc. dba Linux Global by Eric Wheeler
to facilitate optimization of RF matching components, but only for
components that are available for purchase at electronic component
vendors (of course!) [https://youtu.be/xbdBjR4szjE](https://youtu.be/xbdBjR4szjE)
# COPYRIGHT
Copyright (C) 2022 eWheeler, Inc. dba Linux Global
( run in 0.852 second using v1.01-cache-2.11-cpan-39bf76dae61 )