Git Product home page Git Product logo

tol-api-js's Introduction

Javascript Client for the TOL API

This is a jQuery based client for the TraderOnline API.

Requirements

The client library is based off and tested with jQuery, although it may work with Zepto.js or other alternatives.

Usage

Usage of the API is fairly simple. It will automatically handle fetching an OAuth2 token for you as long as you setup your credentials beforehand. If the token expires, it will transparently fetch a new one in the same manner as done before.

Here is an example set of code that relies on this automatic fetching.

TOL.client.id = 'yourClientId';
TOL.client.secret = 'yourClientSecret';

TOL.request({
    path: 'realms',
    success: function(data) {
        console.log(data);
    }
});

Posting data is fairly simple as well:

TOL.request({
    path: 'videos',
    type: 'POST',
    data: {
        video: {
            realmId: 5,
            videoType: 'dealer',
            videoUrl: 'http://youtu.be/9bZkp7q19f0'
        }
    },
    success: function(data) {
        console.log(data);
    }
});

Development

The included example is a simple Node.js application. You can start it up with:

node index.js

Alternatively, using foreman, you can just run

foreman start

tol-api-js's People

Contributors

nubs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.