Skip to content
/ soda-js Public
forked from socrata/soda-js

A Javascript-based library for accessing the SODA2 API.

Notifications You must be signed in to change notification settings

gremz/soda-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soda-js

A client implementation of the Socrata Open Data API in Coffeescript and Javascript.

Supported Operations

Supports both consumer and producer API, but does not currently support creating datasets or the import workflow.

Usage

See the sample/ directory for sample code, but here’s the general idea:

var soda = require('soda-js');

Consumer API

You can query a dataset by SODA2 clauses, or supply a custom SoQL query to be run.

var consumer = new soda.Consumer('explore.data.gov');

consumer.query()
  .withDataset('644b-gaut')
  .limit(5)
  .where({ namelast: 'SMITH' })
  .order('namelast')
  .getRows()
    .on('success', function(rows) { console.log(rows); })
    .on('error', function(error) { console.error(error); });

Producer API

You can add, update, replace, delete, and upsert rows, as well as truncate a dataset.

var producer = new soda.Producer('sandbox.demo.socrata.com', sodaConnectionOptions);

var data = { mynum : 42, mytext: "hello world" }

producer.operation()
  .withDataset('rphc-ayt9')
  .add(data)
    .on('success', function(row) { console.log(row); })
    .on('error', function(error) { console.error(error); })

License

Provided under the MIT license.

About

A Javascript-based library for accessing the SODA2 API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published