Installation
Install the package via npm (also see the npm package page):Browser CDN Links
For browser-based environments, you can include the API bindings directly from the Edge Impulse Studio CDN:- Development / Debugging:
https://studio.edgeimpulse.com/api-bindings/browser/edge-impulse-api.js - Minified Production Version:
https://studio.edgeimpulse.com/api-bindings/browser/edge-impulse-api.min.js - TypeScript Definition File:
https://studio.edgeimpulse.com/api-bindings/browser/edge-impulse-api.d.ts
Examples
Instantiating the Library
JavaScript (CommonJS)Authenticating
API Key
API Keys grant access to a single project and have a permission scope.Username / Password (JWT)
Username and password authentication gives access to every project in your account. Where possible, use API keys instead. You can cache the JWT token (typically valid for 30 days, unless reconfigured by your enterprise administrator) to avoid putting your credentials directly in code.Calling API Functions
The following example lists active projects and retrieves project information.Running Jobs
Long-running API calls (such as retraining a network) return a job. Here is how you retrain a Keras model block, wait for the job to complete, and print the real-time logs:Browser Integration
Simple Browser Example
The following is a complete HTML and JavaScript example using the Edge Impulse API bindings bundle in the browser:TypeScript Integration
When using the browser bindings in a TypeScript project, you can get type safety for the globalEdgeImpulseApi class by referencing the declaration file edge-impulse-api.d.ts using a triple-slash directive at the top of your TypeScript file:
EdgeImpulseApi and window.EdgeImpulseApi variables, allowing type-safe interaction without needing an import statement.