Skip to content

meallogger/foodcatalog-javascript-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PassioFoodCatalog

PassioFoodCatalog - JavaScript client for PassioFoodCatalog Welcome to the Passiolife Food Catalog API. The Passiolife Catalog API is organized around the REST methodology, and it uses resource-oriented URLs, and common HTTP response codes to indicate API errors. All requests are authenticated using an api-key which can be obtained by signing up.
This SDK is automatically generated by the Swagger Codegen project:

  • API version: 0.2-beta
  • Package version: 0.2-beta
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install PassioFoodCatalog --save

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Getting Started

Please follow the installation instruction and execute the following JS code:

var PassioFoodCatalog = require('PassioFoodCatalog');

var defaultClient = PassioFoodCatalog.ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['key'] = "Token"

var api = new PassioFoodCatalog.DefaultApi()

var body = new PassioFoodCatalog.ClassifyRequest(); // {ClassifyRequest} The image to analyze base64 encoded


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.classifyMedia(body, callback);

Documentation for API Endpoints

All URIs are relative to https://foodcatalog-api-dot-bpiproject-145417.appspot.com/beta

Class Method HTTP request Description
PassioFoodCatalog.DefaultApi classifyMedia POST /classify Classify an Image
PassioFoodCatalog.DefaultApi feedback POST /feedback Provides feedback on the generated classification

Documentation for Models

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: key
  • Location: URL query string