Skip to content

Commit

Permalink
added api integration help page
Browse files Browse the repository at this point in the history
  • Loading branch information
replaysMike committed Feb 18, 2023
1 parent a74b63d commit 708856b
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 33 deletions.
3 changes: 2 additions & 1 deletion Binner/Binner.Web/ClientApp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ResistorColorCodeCalculator } from "./pages/tools/ResistorColorCodeCalc
import { VoltageDividerCalculator } from "./pages/tools/VoltageDividerCalculator";
import { Help } from './pages/help/Home';
import { Scanning } from './pages/help/Scanning';

import { ApiIntegrations } from './pages/help/ApiIntegrations';

export default class App extends Component {
static displayName = App.name;
Expand Down Expand Up @@ -87,6 +87,7 @@ export default class App extends Component {
/>
<Route exact path="/help" element={<Help />} />
<Route path="/help/scanning" element={<Scanning />} />
<Route path="/help/api-integrations" element={<ApiIntegrations />} />
</Routes>
</Layout>
<ErrorContext.Provider value={this.state}>
Expand Down
116 changes: 116 additions & 0 deletions Binner/Binner.Web/ClientApp/src/pages/help/ApiIntegrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { Segment, Breadcrumb, Image } from "semantic-ui-react";
import "./help.css";

export const ApiIntegrations = () => {
const navigate = useNavigate();
return (
<div>
<Breadcrumb>
<Breadcrumb.Section link onClick={() => navigate('/')}>Home</Breadcrumb.Section>
<Breadcrumb.Divider />
<Breadcrumb.Section link onClick={() => navigate('/help')}>Help</Breadcrumb.Section>
<Breadcrumb.Divider />
<Breadcrumb.Section active>Api Integrations</Breadcrumb.Section>
</Breadcrumb>
<h1>How to configure API Integrations</h1>

<Segment raised>
<h3>Overview</h3>
<p>
Binner currently supports Binner Swarm, Digikey, Mouser, Octopart and AliExpress. For standalone installations, you will need to obtain your own API keys to enable these features. It's easy to obtain them but be aware Octopart is not free so you may want to avoid using it. Alternatively you can use Binner.io if you do not wish to worry about configuring external API's.
</p>
<p>
Integrations enable features such as automatic part metadata lookup, datasheet retrieval and automatic importing parts from your orders. To get the best out of Binner, it is a good idea to sign up for Digikey and Mouser API keys at a minimum however they are not required.
</p>
<p>
Configuration values can be found in appsettings.json alongside the Binner executable.
</p>


<h3>Configuring Binner Swarm API</h3>

<p>
Binner comes with free Swarm API support built-in. Swarm is an aggregate of part information that includes parametrics, datasheets, product images, pinouts and schematics. It is a new service, so content is still being expanded and indexed so a lot more data will be coming in the near future. There is a limit on how many Swarm requests can be made per hour/day - if you feel you need larger limits you can signup for a free or paid account at <a href="https://binner.io/swarm">https://binner.io/swarm</a> and your limits are increased accordingly.
</p>

<h4>Settings example</h4>
<code><pre>// appsettings.json<br/>
{JSON.stringify({ Integrations: {
Swarm: {
Enabled: true,
ApiKey: "",
ApiUrl: "https://swarm.binner.io",
},
},}, null, 2)}</pre></code>

<h3>Configuring DigiKey API</h3>
<p>
Visit <a href="https://developer.digikey.com">https://developer.digikey.com</a> and sign up for a free developer account. You will be asked to create an App which will come with a ClientId and ClientSecret and needs to be set in the appsettings.json under the DigiKey configuration section.
</p>

<h5>Creating an App</h5>

<div className="bullet">
The DigiKey Api uses oAuth with postbacks so this must be configured in your DigiKey developer account. DigiKey calls this a <b>Callback URL</b>, while in Binner this is the <b>oAuthPostbackUrl</b>. This can be safely set to <b>https://localhost:8090/Authorization/Authorize</b> in both systems. It is not called by their servers, but rather by the web UI so it does not need to resolve to an external IP and requires no firewall settings. It must be set to exactly the same value on both systems.
<div className="helpimage">
<img src="/image/help/digikey-callbackurl.png" alt="DigiKey Callback URL" />
Figure 1. DigiKey's api settings, located in the DigiKey api <a href="https://developer.digikey.com">developers portal</a>
</div>

</div>

<div className="bullet">You will want to enable API access for the Product Information, Order Support, and Barcode Apis.</div>

<h5>Sandbox</h5>

<p>If you wish to use the DigiKey sandbox rather than their production API, you can specify the ApiUrl to use <b>https://sandbox-api.digikey.com</b>. Otherwise, you can leave it set to <b>https://api.digikey.com</b></p>

<h4>Settings example</h4>
<code><pre>// appsettings.json<br/>
{JSON.stringify({ Integrations: {
Digikey: {
Enabled: true,
ClientId: "KsGAFuZGErn4zgvFDI9ux4nW3vZ63H3r",
ClientSecret: "IAbQsT4GCnagahrH",
oAuthPostbackUrl: "https://localhost:8090/Authorization/Authorize",
ApiUrl: "https://api.digikey.com",
},
},}, null, 2)}</pre></code>

<h3>Configuring Mouser API</h3>
<p>Visit <a href="https://www.mouser.com/api-hub/">https://www.mouser.com/api-hub</a> and sign up for a free developer account. Mouser requires you to sign up for each API product you wish to use. Currently, Binner supports both the Search API and Order API so sign up for those two APIs separately. Once you have an API key for each, set those in the <i>appsettings.json</i> under the Mouser configuration section.</p>

<h4>Settings example</h4>
<code><pre>// appsettings.json<br/>
{JSON.stringify({ Integrations: {
Mouser: {
Enabled: true,
ApiKeys: {
SearchApiKey: "84e40c37-99de-4990-86c2-290749dc7f52",
OrderApiKey: "2d1a00d7-16fd-4979-b7e3-5ca384711ab2",
CartApiKey: ""
},
ApiUrl: "https://api.mouser.com"
},
},}, null, 2)}</pre></code>

<h3>Configuring Octopart API</h3>
<p>Visit <a href="https://octopart.com/api/home">https://octopart.com/api/home</a> and sign up for a developer account. Please note that Octopart API is not free to use so you may opt to skip this one. They don't advertise pricing until you start using the API (sneaky), but if you already have a key it can be used for additional datasheet support. If you do not wish to use it Digikey and Mouser will be used to access datasheets for parts, as well as the free Binner datasheet API.</p>

<h4>Settings example</h4>
<code><pre>// appsettings.json<br/>
{JSON.stringify({ Integrations: {
Octopart: {
Enabled: true,
ApiKey: "b3h5632j245jh5521426",
ApiUrl: "https://octopart.com"
},
},}, null, 2)}</pre></code>

</Segment>

</div>
);
}
1 change: 1 addition & 0 deletions Binner/Binner.Web/ClientApp/src/pages/help/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const Help = () => {
<div className="helpcontainer">
<ul>
<li><Link to="/help/scanning">Barcode Scanning</Link><p>Learn more about what types of features are available using a handheld barcode scanner.</p></li>
<li><Link to="/help/api-integrations">Api Integrations</Link><p>Configuring Api integrations are an important part of using Binner effectively.</p></li>
<li><a href="https://github.com/replaysMike/Binner/wiki">Wiki</a><p>Get more help from the wiki on GitHub</p></li>
</ul>
</div>
Expand Down
34 changes: 2 additions & 32 deletions Binner/Binner.Web/ClientApp/src/pages/help/Scanning.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,40 +79,10 @@ export const Scanning = () => {
<Segment>
<h4>Mouser</h4>

<p>
Mouser uses different types of barcodes for it's various paperwork and labeling. Invoices use a standard code-128 barcode which can be scanned on the Order Import page.<br/><br/>
Parts use a 2D DotMatrix barcode so you must have a scanner that supports 2D barcodes.
<p style={{textAlign: 'center', margin: '100px'}}>
Mouser barcode scanning support is <i>coming soon</i>! Look for it in the next feature release.
</p>

<h5>Scanning Parts</h5>
By scanning the 2D Dotmatrix barcode on a part label you can:<br/><br/>
<ul>
<li>Search for parts in your inventory on the Search page</li>
<li>Add new parts to your inventory on the Add Inventory page</li>
<li>Bulk import new parts on the Add Inventory page</li>
</ul>

<div className="helpvideo">
<img src="/image/help/digikey-label.jpg" alt="Mouser DotMatrix 2D Barcode" style={{width: '400px', height: 'auto'}} />
Example 1. This is a 2D DotMatrix barcode on a standard Mouser part label.
</div>

<h5>Importing Orders</h5>

<p>
On the <Link to="/import">Order Import</Link> page you can scan one of your past orders to import all parts in the order at once.<br/>
To do so, you will need the Mouser packing list for your order. The invoice doesn't contain the barcodes you want, however you can type in the Sales Order Number manually easily as well.

</p>

<div className="helpvideo">
<img src="/image/help/digikey-packinglist.jpg" alt="Mouser DotMatrix 2D Barcode" style={{width: '600px', height: 'auto'}} />
Example 2. There are multiple 1D code-128 barcodes, and several 2D DotMatrix barcodes on a standard Mouser packing list.
</div>

<p>The Sales Order number can be scanned (top right) to import the entire - <i>or parts of</i> an order. You can also scan the 2D DotMatrix barcodes which provide the same information.</p>
<p>Additionally, each itemized part can be scanned in the packing list but this is only supported on the Add Inventory page. Note there is a barcode for both the part as well as a smaller barcode for its quantity.</p>

</Segment>

</Segment>
Expand Down
43 changes: 43 additions & 0 deletions Binner/Binner.Web/ClientApp/src/pages/help/help.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,47 @@ img.helpvideo {
display: block;
border: 1px dotted #666;
padding: 5px;
}

textarea {
width: 75%;
height: 200px;
}

code {
background: #f4f4f4;
border: 1px solid #ddd;
border-left: 3px solid #f36d33;
color: #666;
page-break-inside: avoid;
font-family: monospace;
font-size: 15px;
line-height: 1.6;
margin-bottom: 1.6em;
max-width: 100%;
padding: 1em 1.5em;
display: block;
word-wrap: break-word !important;
white-space: pre-line !important;
}

pre {
white-space: pre !important;
}

p > b, li > b, .bullet > b {
font-weight: 600;
color: rgb(0, 115, 204);
}

li {
padding: 10px 0;
margin-left: 30px;
}

.bullet {
border-left: 2px solid #3340f3;
padding: 10px;
margin-left: 30px;
margin-bottom: 15px;
}

0 comments on commit 708856b

Please sign in to comment.