Skip to content
The Apigee Mobile Development SDK for HTML5 Apps!
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Apigee JavaScript SDK

App Services Getting Started

Detailed instructions follow but if you just want a quick example of how to get started with this SDK, here’s a minimal HTML5 file that shows you how to include & initialize the SDK, as well as how to read & write data from Apigee App Services with it.

<!DOCTYPE html>
        <!-- Don't forget to download and include the SDK -->
        <!-- It’s available at -->
        <script src="path/to/apigee.js"></script>

        <script type="text/javascript">

            // Initializing the SDK
            var client = new Apigee.Client({
                orgName:'yourorgname', // Your username for App Services
                appName:'sandbox' // Your Apigee App Services app name

            // Reading data
            var books = new Apigee.Collection({ "client":client, "type":"books" });
                function(err, data) { // Success
                    if (err) {
                        alert("read failed");
                    } else {
                        while(books.hasNextEntity()) {
                            var book = books.getNextEntity();
                            alert(book.get("title")); // Output the title of the book

            // Uncomment the next 4 lines if you want to write data

            // book = { "title": "the old man and the sea" };
            // books.addEntity(book, function (error, response) {
            //  if (error) { alert("write failed");
            //  } else { alert("write succeeded"); } });


With v2.0.6, we're using the Grunt task runner to build the Apigee library from modular components. You will need to have NodeJS installed on your system. The following steps will produce apigee.js and apigess.min.js files in the project's source directory.

  1. npm install grunt-cli -g *may require elevated privileges
  2. git clone apigee-javascript-sdk
  3. cd apigee-javascript-sdk
  4. npm install
  5. grunt

App Monitoring Getting Started

App monitoring is enabled by default by initializing the Apigee.Client object. You can also use the following methods for logging calls.

  • logVerbose()
  • logDebug()
  • logInfo()
  • logWarn()
  • logError()
  • logAssert()

More documentation

Head over to the Apigee Mobile SDK wiki to learn more about how to use App Services in JavaScript!

Crash Reporting

The app monitoring portion of the SDK will monitor the window.onerror event to track if your app experiences javascript crashes.

Network Call Monitoring

The SDK will also monitor your network calls to track errors and usage. This configuration is pulled from the rules that you configure on the App Monitoring dashboard.

Simple and Advanced Logging

You can log specific events in your SDK by using one of the many log methods. You may also use the console logging methods to track messages. This is configured in the App Monitoring dashboard.

Figuring out your device type

App monitoring will automatically detect the specific information about your device, analyze data that is collected by device type. The level of granularity in detection is also controlled by the App Monitoring dashboard.


You can start a simple web server by running grunt dev. You can then access the samples at port 3000 on localhost.


Basic set of test cases can be found in the /test folder. Just open the tests.html file, and they will all run accordingly. configuration

The following plugins should be enabled:

  1. is
  2. event

Or the SDK will not function properly!

Titanium Configuration

For the SDK to properly report device based metrics like OS and version name we need to add this snippet of code anywhere in your app.js file.

Ti.App.addEventListener('analytics:attachReady', function(e){


We welcome your enhancements!

Like Usergrid, the Apigee JavaScript SDK is open source and licensed under the Apache License, Version 2.0.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push your changes to the upstream branch (git push origin my-new-feature)
  5. Create new Pull Request (make sure you describe what you did and why your mod is needed)

More information

For more information on Apigee App Services, visit


Copyright 2013 Apigee Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Something went wrong with that request. Please try again.