# octopartjs

> Nodejs library for octopart API

Latest version **1.0.6** (published 2018-06-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install octopartjs
pnpm add octopartjs
yarn add octopartjs
bun add octopartjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2018-06-27 |
| First published | 2017-10-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Orlando |
| Maintainers | orlandofloresti |

## Links

- npm: https://www.npmjs.com/package/octopartjs
- Repository: https://github.com/orlandofloresti/octopartjs
- Homepage: https://github.com/orlandofloresti/octopartjs#readme
- Issues: https://github.com/orlandofloresti/octopartjs/issues
- npm.io page: https://npm.io/package/octopartjs

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.87.0

## Recent versions

- 1.0.6 (latest) — 2018-06-27
- 1.0.5 — 2017-10-26

## README

# Octopart js
Nodejs library for Octopart API (V3) with callbacks

Powered by Octopart

```javascript
const octopartjs = require('octopartjs');

octopartjs.apikey('API-KEY');
```
You can get your api key in the url: https://octopart.com/api/home

## Endpoints
Based on the Octopart API reference (V3)
### Brands
```javascript
octopartjs.brands.uid()
octopartjs.brands.search()
octopartjs.brands.get_multi()
```
### Categories
```javascript
octopartjs.categories.uid()
octopartjs.categories.search()
octopartjs.categories.get_multi()
```
### Parts
```javascript
octopartjs.parts.uid()
octopartjs.parts.match()
octopartjs.parts.search()
octopartjs.parts.get_multi()
```
### Sellers
```javascript
octopartjs.seller.uid()
octopartjs.seller.search()
octopartjs.seller.get_multi()
```
## Examples
Based on the Octopart API reference (V3)

### Example with endpoint /brands/{uid}
```javascript
var uid = '2239e3330e2df5fe';

octopartjs.brands.uid(uid, (err, body) =>{
   if(err){
     console.log(err);
   }else {
     console.log(body);
   }
});
```
### Example with /brands/search
```javascript
var args = {
   q: "Texas",
   start: 0,
   limit: 10
 };

octopartjs.brands.search(args, (err, body) =>{
  if(err){
    console.log(err);
    }else {
    console.log(body);
   }
});
```
### Example with /brands/get_multi
```javascript
var args = {
 uid: [
   "2239e3330e2df5fe",
   "c4f105fbe7591336"
 ]
};

octopartjs.brands.get_multi(args, (err, body) =>{
 if(err){
   console.log(err);
 }else {
   console.log(body);
 }
});
```
### Example with /parts/match
```javascript
var queries = [
  {'mpn': 'SN74S74N', 'reference': 'line1'},
  {'sku': '67K1122', 'reference': 'line2'},
  {'mpn_or_sku': 'SN74S74N', 'reference': 'line3'},
  {'mpn': 'SN74S74N', 'brand': 'Texas Instruments', 'reference': 'line4'}
];

var args = {
  queries: JSON.stringify(queries)
};

octopartjs.parts.match(args, (err, body) =>{
  if(err){
    console.log(err);
  }else {
    for(i in body){
      console.log(body);
    }
  }
});
```
### Example with /parts/search
```javascript
var args = {
  q: "lm350",
  start: 0,
  limit: 10
};

octopartjs.parts.search(args, (err, body) =>{
  if(err){
    console.log(err);
  }else{
    console.log(body);
  }
})
```

---
_Source: https://npm.io/package/octopartjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
