##Javascript SDK for Built.io Contentstack
##Prerequisite
You need to install node.js v0.10.22 or later to use the Built.io Contentstack SDK.
## Installation
You might need administrator privileges to perform this installation.
```bash
$ npm install contentstack
```
To require the SDK module in your application use the following command.
```bash
$ var contentstack = require('contentstack');
```
## Basic Structure
The structure followed by SDK logically resembles the site structure on Built.io Contentstack. Once you have done the basic setup explained in the Installation section, you get a Built.io Contentstack object, which can be used to initialize different modules. The initialization process for each module is explained below.
###Site
To initialize a site, you need to provide the required keys and values associated with them.
```bash
var site = contentstack.Site({"site_api_key":"abcdef1234567890","access_token":9876543210qwerty","environment":"development"});
```
Let us take an example where we try to obtain all entries of the form my_form.
```bash
var entry = site.Form('my_form').Query();
entry
//add query methods here
.find()
.then(function(data){
//data will contain entries from the form my_form;
},function(err){
//displays a detailed error in case of failure;
});
```
Let us take another example where we try to obtain only a specific entry from the form my_form.
```bash
var entry = site.Form('my_form').Entry(uid);
entry
//add query methods here
.fetch()
.then(function(data){
//data will contain entries from the form my_form;
},function(err){
//displays a detailed error in case of failure;
});
```
-----
Links
License
MIT Copyright © 2014 raw engineering, inc.