Skip to content

Configuring API Integrations

Michael Brown edited this page Nov 12, 2019 · 4 revisions

How to configure API Integrations

Binner currently supports 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.

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.

Configuration values can be found in appsettings.json alongside the Binner executable.

Configuring DigiKey API

Visit https://developer.digikey.com/ 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.

Creating an App

  • The API uses oAuth with postbacks so they will want you to provide an OAuth Callback. This can be safely set to http://localhost:8090/Authorization/Authorize. If you are not familiar with oAuth, Digikey will call this URL when you successfully authenticate with DigiKey. It is not called by their servers, but rather by the web UI so it does not need to resolve to an external IP. It does need to be set exactly the same in Binner's oAuthPostbackUrl in appsettings.json otherwise the API calls will not work, as this value must match on both ends.

  • You will want to enable API access for the Product Information and Order Support APIs.

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

Settings example

// appsettings.json
"Integrations": {
    "Digikey": {
        "ClientId": "KsGAFuZGErn4zgvFDI9ux4nW3vZ63H3r",
        "ClientSecret": "IAbQsT4GCnagahrH",
        "oAuthPostbackUrl": "http://localhost:8090/Authorization/Authorize",
        "ApiUrl": "https://api.digikey.com"
    },
},

Configuring Mouser API

Visit https://www.mouser.com/api-hub/ 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 appsettings.json under the Mouser configuration section.

Settings example

// appsettings.json
"Integrations": {
    "Mouser": {
        "ApiKeys": {
          "SearchApiKey": "84e40c37-99de-4990-86c2-290749dc7f52",
          "OrderApiKey": "2d1a00d7-16fd-4979-b7e3-5ca384711ab2",
          "CartApiKey": ""
        },
        "ApiUrl": "https://api.mouser.com"
    },
},

Configuring Octopart API

Visit https://octopart.com/api/home 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.

Settings example

// appsettings.json
"Integrations": {
    "Octopart": {
        "ApiKey": "b3h5632j245jh5521426",
        "ApiUrl": "https://octopart.com"
    },
},

Clone this wiki locally