Neologistic Paraphasic Mumbling
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


0.1.1 • Public • Published Node Library


A node library for the API
See full API documantation at Also check out a working demo of all the api calls by running demo.js


The simplest way to install is with npm:

  npm install ordrin-api



  var ordrinApi = require("ordrin-api");

  var ordrin = ordrinApi.init({
    apiKey: "YOUR-ORDRIN-API-KEY",
    restaurantUrl: "",
    userUrl: "",
    orderUrl: ""

Note that for the Urls https:// and the trailing / are all implied. DO NOT include them in the Url strings. The API only supports https requests.


Because node is async every function call you make to the ordrin api includes a callback. This will be called when the api has finished your request. The format of this callback is always the same.
It takes two parameters: error and data.
If there's no error than error will be false, otherwise it will be an object.
Data is an object containing the data returned from the api as described in the API documentation located at

Example function callback:

  var callback = function(error, data){
    if (error){
      console.error(" API error", error.msg);
      // program logic

Data Structures

The following classes are part of the library and are used whenever you need to pass an address, credit card, user, tray item, or tray to a library function.

  Address = {
    addr: String,
    city: String,
    state: String,
    zip: Number,
    phone: Number,
    addr2: String

  CreditCard = {
    name: String,
    expiryMonth: Number,
    expiryYear: Number,
    billAddress: String, // An object of the above address class
    number: Number,
    cvc: Number

  UserLogin = {
    email: String,
    password: String // this is always an unencoded password 

  TrayItem = {
    itemId: Number,
    quantity: Number,
    options: Array // array of option ids

  Tray = {
    items: Array // array of trayItem objects of the above class

You can create an object of one of these classes like so:

  var user = new Ordrin.UserLogin("", "password");


Each of the above Data Structers throw errors if you pass invalid values to their constructors. The errors are children of the javascript Error class, and include the additional property fieldErrors. This describes the different validation errors that occured. Example

    var address = new Ordrin.Address("1 Main Street", "College Station", "RDS", 7765, 1234);
  }catch (e){
The above example will print out an object that contains the properties: state, zip, and phone since those were the invalid properties. And a short message with each one that describes what was invalid. 
You can see validation in action in the demo script.

### Restaurant API, address, callback);, dateTime, address, callback);, subtotal, tip, dateTime, address, callback);, callback);

User API

  ordrin.user.getUser(userLogin, callback);

  ordrin.user.createUser(userLogin, firstName, lastName, callback);

  ordrin.user.getAllAddresses(userLogin, callback);

  ordrin.user.getAddress(userLogin, addressName, callback);

  ordrin.user.setAddress(userLogin, addressName, address, callback);

  ordrin.user.removeAddress(userLogin, addressName, callback);

  ordrin.user.getAllCreditCards(userLogin, callback);

  ordrin.user.getCreditCard(userLogin, cardName, callback);

  ordrin.user.setCreditCard(userLogin, cardName, creditCard, callback);

  ordrin.user.removeCreditCard(userLogin, cardName, callback);

  ordrin.user.getOrderHistory(userLogin, callback);

  ordrin.user.getOrderDetails(userLogin, orderId, callback);

  ordrin.user.setPassword(userLogin, newPassword, callback);

Order API

The Order API includes the ability to create a new user when you place the order. If you want to do that just pass in the new user's login credentials in the user object, and set createUser to true.

If you don't want the order to be associated with a user account then pass in false as the password inside the user object, and setCreateUser to false.

  ordrin.order.placeOrder(restaurantId, tray, tip, deliveryTime, firstName, lastName, address, creditCard, user, createUser, callback)




npm i api-node

Downloadsweekly downloads









last publish


  • avatar