Git Product home page Git Product logo

apigee-javascript-sdk's Introduction

#NOTE: THIS REPOSITORY IS DEPRECATED. THE LATEST CODE IS LOCATED HERE.

#Apigee JavaScript SDK

##Getting Started

Detailed instructions are available in our Apigee JavaScript SDK install guide 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.

Be sure to see the full SDK documentation at Apigee.

<!DOCTYPE html>
<html>
	<head>
		<!-- Don't forget to download and include the SDK -->
		<!-- It’s available at https://raw.github.com/apigee/apigee-javascript-sdk/master/source/apigee.js -->
		<script src="path/to/apigee.js"></script>

		<script type="text/javascript">
		
			// Initializing the SDK
			var client = new Apigee.Client({
				orgName:'yourorgname', // Your Apigee.com username for App Services
				appName:'sandbox' // Your Apigee App Services app name
			});

			// Reading data
			var books = new Apigee.Collection({ "client":client, "type":"books" });
			books.fetch(
				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"); } });
		</script>
	</head>
	<body></body>
</html>

##App Monitoring

App monitoring is enabled by default by initializing the Apigee.Client object.

###Network Call & App Usage Monitoring

The SDK will monitor app usage statistics, as well as network calls to track errors and usage. This configuration is pulled from the rules that you configure on the App Monitoring dashboard of the admin console.

For more information, see Monitoring app usage data and Monitoring network performance in the Apigee docs.

###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 of the admin console.

You can use the following methods for logging calls.

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

For more information, see Monitor app errors and crashes in the Apigee docs.

###Crash Reporting

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

For more information, see Monitor app errors and crashes in the Apigee docs.

###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 of the admin console.

For more information, see Customizing app monitoring in the Apigee docs.

##Mobile app development

###PhoneGap

No additional configuration is needed to use the Apigee JavaScript SDK in PhoneGap apps.

###Trigger.io 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){
	Ti.App.fireEvent('analytics:platformMetrics', 
	{
		name:Titanium.Platform.name, 
		osname:Titanium.Platform.getOsname(), 
		model:Titanium.Platform.getModel(), 
		networkType:Titanium.Network.getNetworkTypeName(), 
		uuid:Titanium.Platform.createUUID()
	});
});

##Node.js Module and Other SDKs Want to use Node.js? No problem - use the Usergrid Node Module. You can get it from npm and GitHub

The syntax for this JavaScript SDK and the Usergrid Node module are almost exactly the same so you can easily transition between them.

We also have SDKs available for many other platforms, including Android, iOS, Ruby, .NET. Visit our SDK download page for a full list.

##Tests

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

##More documentation

Head over to the App Services documentation to learn more about how to use App Services in JavaScript!

##Comments / Questions Please feel free to send comments or questions to the Usergrid Google group:

[email protected]

Or just open github issues. We want to know what you think, and will address all suggestions / comments / concerns.

Thank you!

apigee-javascript-sdk's People

Contributors

amuramoto avatar earth2marsh avatar mdobson avatar pdardeau avatar prabhatjha avatar r3b avatar r8k avatar robertwalsh avatar rodsimpson avatar shawnfeldman avatar timanglade avatar wesleyhales avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apigee-javascript-sdk's Issues

[enhancement] Add missing bower.json.

Hey, maintainer(s) of apigee/apigee-javascript-sdk!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library apigee/apigee-javascript-sdk is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "apigee/apigee-javascript-sdk",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Prevent X-Apigee-Client-* headers being sent to non-Apigee requests

I'm using Apigee SDK as well as other APIs.

I see that Apigee is always adding its headers to every HTTP request that goes out, whether the request needs them or not. This is causing issues when using other CORS APIs which don't support these headers, like the Dropbox API.

Access-Control-Request-Headers: authorization,x-apigee-client-app-name,x-apigee-client-device-id,x-apigee-client-org-name,x-apigee-client-request-id,x-apigee-client-session-id,x-dropbox-request-id

How to prevent these headers being sent to other non-Apigee APIs?

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.