Git Product home page Git Product logo

jquery.restapi-client's Introduction

jquery.restapi-client (CRUD)

A jQuery client to connect to Restful API data sources.


USAGE AND INITIALIZATION

Loading the API Class & API configuration.

$.getScript('/_assets/jquery.api/jquery.api.js', function() {

    // Configure your API hosts
    API.get_host = function() {
        switch (location.host) {
            case "www.website.com":
                API.live = true;
                return window.location.protocol+"//api.website.com/v1/";
            case "dev.website.com":
                return window.location.protocol+"//dev-api.website.ccom/v1/";
        }
    }
    
});

API HEADERS (Optional)

Optionally you can set API headers such as authentication tokens and headers with your REST requeest.

API.headers() {
    return {
        "token": "oauthtokens"
    }
}

Getting information from the API:

RESTful Calls (GET, INSERT, UPDATE, DELETE)

All API calls return a function variable to do with as you wish. The API return request structure is flexible to whatever the backend API response will return.

Getting information from an API is as simple as defining the api endpoing and or passing an id parameter to the end poin for a single call:

API.get('ModuleEventsModel/', parameters, function(request) { });
API.get('ModuleEventsModel/1/', parameters, function(request) { });

Inserting and updating information from the API. ON an update the id can be passed in the endpoint or with the parameters variables:

API.insert('ModuleEventsModel/', values, function(request) { });
API.update('ModuleEventsModel/1/', parameters, function(request) { });

Deleting information from the API:

API.delete('ModuleEventsModel/1/', false, function(request) { });

jquery.restapi-client's People

Contributors

joeycaughey avatar

Stargazers

Komputronika avatar  avatar

Watchers

 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.