Coder Social home page Coder Social logo

jdrew1303 / sdatajavascriptclientlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sage/sdatajavascriptclientlib

0.0 0.0 0.0 3.34 MB

Client library in JavaScript for consuming SData web services. Also, an HTML/CSS/JavaScript Mobile application framework.

License: Other

Shell 0.03% JavaScript 99.97%

sdatajavascriptclientlib's Introduction

Information

This repository contains a JavaScript library for consuming SData.

Downloading

Building A Release Version

Requirements

  • Windows

  • The Java Runtime (JRE)

  • The environment variable, JAVA_HOME, pointing to the JRE base path, eg:

    c:\Program Files (x86)\Java\jre6
    

Steps

  1. Open a command prompt and execute the following from the root repository folder, eg:

    build\release.cmd
    
  2. The deployed product will be in a deploy folder in the root repository folder.

Examples

Example: Set up an SData service connection (to be used for rest of examples)

var service = new Sage.SData.Client.SDataService({
    url: 'http://localhost/sdata/slx/dynamic/-/',
    userName: 'admin',
    password: '',
    json: true //if your SData provider supports JSON
});

Example: Make a single resource request (Contact)

var request = new Sage.SData.Client.SDataSingleResourceRequest(service)
	.setResourceKind('contacts')
	.setResourceSelector("'CGHEA0000001'");
    
request.read({
    success: function(entry) { console.log(entry); }
});

Example: Request a resource collection (Contacts)

var request = new Sage.SData.Client.SDataResourceCollectionRequest(service)
    .setResourceKind('contacts')
    .setCount(5)
    .setStartIndex(6); // 1 based, not 0 based (per spec)
    
request.read({
    success: function(feed) { console.log(feed); }
});

Example: Request all of the Contacts for a particular Account

var request = new Sage.SData.Client.SDataResourcePropertyRequest(service)
    .setResourceKind('accounts')
    .setResourceSelector("'AGHEA0002669'")
    .setResourceProperty('Contacts')
    
// use `readFeed` since we are targeting a collection property
request.readFeed({
    success: function(feed) { console.log(feed); }
});

Example: Batch request (combine two account queries)

var batch = new Sage.SData.Client.SDataBatchRequest(service)
    .setResourceKind('accounts')
    .using(function() {
        new Sage.SData.Client.SDataSingleResourceRequest(service)
            .setResourceKind('accounts')
            .setResourceSelector("'AGHEA0002669'")
            .read();
        
        new Sage.SData.Client.SDataSingleResourceRequest(service)
            .setResourceKind('accounts')
            .setResourceSelector("'AA2EK0013031'")
            .read();        
    });
    
batch.commit({
    success: function(feed) { console.log(feed); }
});

sdatajavascriptclientlib's People

Contributors

mmorton avatar stuartcarnie avatar jhershauer 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.