WWW::Socrata - The great new WWW::Socrata!
Version 0.02
use WWW::Socrata; my %options = ( base_url => "https://nycopendata.socrata.com", ); my $socrata = new WWW::Socrata(\%options); my $rh_result = $socrata->get("/api/views/74cu-ncm4/rows.json", {});
This library provides a simple wrapper for accessing some of the features of the Socrata Open Data API from PHP. Currently it only supports HTTP GET operations, but in the future it will support other methods as well.
The library is very simple. To access the Socrata API, you first instantiate a "Socrata" object, passing in the API base URL for the data site you wish to access. The Base URL is always the URL for the root of the datasite, with "/api" added to the path (ex: http://www.socrata.com/api or http://data.medicare.gov/api). Then you can use its included methods to make simple API calls:
This library provides an interface to the SODA Publisher API. If you're new to all this, you may want to brush up on the getting started guide. dev.socrata.com/publisher/getting-started
If you're curious about how things work under the hood, you can also browse the API documentation directly. http://opendata.socrata.com/api/docs/
Additional options when creating the new Socrata object
use WWW::Socrata; my %options = ( base_url => "https://nycopendata.socrata.com", app_token => "", #optional username => "", #optional for authenticated requests password => "", #optional for authenticated requests ); my $socrata = new WWW::Socrata(\%options);
You may also add additional criteria on the get function, for searching or retrieving subsets of the data
my $rh_result = $socrata->get("/api/views/74cu-ncm4/rows.json", { "method"=>"getRows", "start"=>120, "length" =>60, });
Benjamin Marcus, <ben at fourthfloorequipment.com>
<ben at fourthfloorequipment.com>
Please report any bugs or feature requests to bug-www-socrata at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Socrata. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-socrata at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Socrata
You can also look for information at: http://www.socrata.org
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Socrata
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Socrata
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Socrata
Search CPAN
http://search.cpan.org/dist/WWW-Socrata/
Copyright 2012 Benjamin Marcus.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install WWW::Socrata, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Socrata
CPAN shell
perl -MCPAN -e shell install WWW::Socrata
For more information on module installation, please visit the detailed CPAN module installation guide.