Access Privileges
Overview
The WiserEarth API (Application Programming Interface) opens up the WiserEarth database for the community to use. It allows anyone with a good idea and some programming skills to help expand the usefulness of WiserEarth. We encourage our community to join our WiserEarth API developers group, to post ideas or questions they may have, and to help us continue to build WiserEarth.
To see sample code for a working demo client for the API, visit this page:
http://www.wiserearth.org/article/e8b2e01e6e2aa803f88ad12e8839d391/
We'd like to thank and give credit to the excellent API documentation at Kiva.org, SocialActions.org and Flickr.com for helping us improve our documentation. Many thanks for their hard work in making technical documentation more user-friendly!
For our API, we decided to use the simplest method possible by developing a set of RESTful web-services. We're still in the beginning stages of building our API, so right now the API only allows developers to GET data and SEARCH for data on WiserEarth. In other words, you can only retrieve information from WiserEarth - you can't yet post information (i.e. create an event listing) through the API. We plan to expand the API so that developers can also POST data to WiserEarth; this will allow users to send information back to WiserEarth (i.e. submit an event listing to WiserEarth from another site).
This documentation is to help you get started working with API. We'll do our best to make it as user-friendly as possible so that technical and non-technical readers can follow along. We'll introduce terminology and explain them as best we can, and show you examples on the data objects that you can work with in the API. If you'd like to first brush up on what an API is, we recommend this "HowStuffWorks" article about APIs.
API Output
Information requested through the API will be returned in XML format. We also plan to provide output in JSON format once we are finished upgrading our framework to Symfony version 1.2.
API Terms of Use
The WiserEarth API Terms of Use is available here.
Data and Services available through the API
Get Request API - allows developers to retrieve information about a particular record if they know the masterid
Search Request API - allows developers to perform a search for WiserEarth's data
Write request API - in development, will allow API clients to send information to WiserEarth's database
API features in development
- Enhanced Geographic search using Longitude/Latitude coordinates
- Caching flags
- JSON output
- Write API
Getting Started
To help you get started, here's a couple steps we recommend:
Step 1: Read the API Terms of Use
We know it's not the most exciting thing in the world to read legal terms and community guidelines, but we want to make sure that the idea you have in mind for using the API follows along with the principles of WiserEarth.org. Please take a moment to look through the Terms of Use just to make sure things are clear before you get started.
Step 2: Get your API key and corresponding Secret code
To send authorized calls to the API, you first need an API Key, which looks like a long string of letters and numbers.
Example API Key: 655d0a0a869d070f213a9290d7d1346e.
To get your API key, sign up first for an account on WiserEarth, then visit this page to request your key:
http://www.wiserearth.org/api/create_key
Follow the steps as outlined and you will also be given an API key and a corresponding Secret code. Keep both handy, as you will need it when making your API request.
To make the request, you concetenate the MasterID of the record with the Secret code you received. In other words, the combination of the record MasterID + your secret code creates a Signature used to authorize your request. Taking a look at some example API key and secret code, you can see how the secret code is combined with the MasterID of the solution record to create your signature.
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$solutionMasterid = '800f18f66ac105ba42b83b781e7bfba5';
$sig = md5('masterid'.$solutionMasterid.$secret); (<--- This creates your Signature)
Step 3: Try our demos for retrieving information for an organization or for running a search
Our API method can easily be tested with just about any browser. As an example, try out this link to see what information you would get when you retrieve information about an organization:
http://www.wiserearth.org/organizations/<replace_with_organizationMasterid>?sig=<replace_with_signature>&key=<replace_with_api_key>
Note that to retrieve information about a particular organization, you will need to have 3 things handy: the unique MASTERID, your API key, and your API SIGNATURE CODE. We'll explain more about these 3 things in our Simple Data Types section.
Another demo you can try is our Search API - this allows you to run a search for information as if you were on the WiserEarth site itself. Very handy for pulling out information about a wide variety of data objects (i.e. organizations, groups, jobs, events, etc).
This example shows a search for organizations in WiserEarth:
http://www.wiserearth.org/organizations/api_search?language=EN&sig=<replace_with_signature>&key=<replace_with_api_key>
Note that this time, you won't need the MASTERID, as you're not pulling information about just 1 organization, but performing a search. We'll discuss more about the various search parameters you can put into that string to further refine your search results (i.e. restrict your search to keywords, location, organization type, etc)
Step 4: Check out the WiserEarth API Developers group
Come join our group and start a discussion around your idea for your application. Get feedback and thoughts and perhaps even programming help for your idea. It's a great way to develop what sort of uses you are envisioning for your application. Once you have your idea roughly sketched up, you'll want to familiarize yourself more fully with the API, so here are some good next steps:
1. Learning about our API Conventions
2. Familiarizing yourself with the Terminology used in this documentation
API Conventions
RESTfulThe WiserEarth API is a web-service API, meaning it works quite like a website. To get information, you make an HTTP GET request to the WiserEarth API. The API then sends a response in turn retrieving the information you requested - just like how it works when you use a browser to get information from a website.
More specifically, the WiserEarth API is a RESTFUL web-service API. REST refers to a style of software architecture that is widely used among APIs, with advantages of being easy to use and simple to set up. RESTful means that while we follow the main principles of REST architecture, we retain some flexibility in our setup to make it as efficient as possible for the community.
WiserEarth's web-service API allows you to retrieve information for the data objects you currently see on the site, including:
- Organizations
- Groups
- Jobs
- Events
- People
- Solutions
Note that the API does not allow you to retrieve information about People, as we have opted out to respect the privacy preferences of our community.
So if you wanted to get information about a particular job on WiserEarth, you would use an HTTP GET request accompanied by the proper URI (Uniform Resource Identifier) that would identify the job you're looking for. (What's the difference between a URL and a URI? We'll explain in the Terminology section)
In time, as we expand upon the API to allow developers to submit information to WiserEarth (i.e create a job posting) through the API, you could send an HTTP POST request to do so. Since we're currently only support the retrieval of information, we'll just focus on the GET requests for now.
RESPONSE formats
If you make a WiserEarth call, you'll get either a successful response or an error message. If the call was successful, you'll get an HTTP response with a status of 200 and the content of the response will be data, usually organized by the names of the categories returned.
Currently, you can only get response data from the WiserEarth API in XML (eXtensible Markup Language) format. We do have plans to also return data in JSON format - once we upgrade our system fully to Symfony 1.2, we'll have native JSON output from our API. We'll announce that feature as soon as we have it on the WiserEarth API developers group.
Here's a simplified API response in XML:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" version="1.0">
<results>
<organization
href="http://www.wiserearth.org/organization/view/4f859f661540d5e704645dffb555d9a0"
id="4f859f661540d5e704645dffb555d9a0"
Name="Community, <b>Environment</b>, and Planning "
Website="http://cep.caup.washington.edu/ "
City="Seattle "
Province="" State="Washington"
Country="United States"
Area="Sustainable Communities,Sustainable Urban and Regional Planning"
Type="Educational Organization"
Scope="regional"
Average_Rating=""
Number_Of_Ratings="0"
Updated="1 day ago"
Score="50"
Avatar="http://www.wiserearth.org/images/icons/org/non_profit_lg.png">
<About><![CDATA[Community, <b>Environment</b>, and ... positive change. ]]></About>
</organization>
<organization
href="http://www.wiserearth.org/organization/view/ffc4b38041e3f13d3f03863275280a62"
id="ffc4b38041e3f13d3f03863275280a62"
Name="4H Club &#34;Upe&#34; Karsava "
Website=""
City="Karsava "
Province=""
State=""
Country="Yugoslavia"
Area="Community Participation,Natural Resource Conservation,<b>Environmental</b> Education"
Type="Non Governmental Organization"
Scope="national"
Average_Rating=""
Number_Of_Ratings="0"
Updated="over 3 years ago"
Score="30"
Avatar="http://www.wiserearth.org/images/icons/org/non_profit_lg.png">
<About><![CDATA[Our Priorities of work: ---> <b>environmental</b> education ---> nature protection ---> ]]></About>
</organization>
<organization
href="http://www.wiserearth.org/organization/view/64e91cc9b53191940bbab5ba27d3e8d4"
id="64e91cc9b53191940bbab5ba27d3e8d4"
Name="10,<b>000</b> Kites "
Website="www.10000kites.org "
City=""
Province=""
State=""
Country="Israel"
Area="Peace and Peace Building,Conflict Resolution,Cultural Diversity,Ecopsychology,Militarism and Violence,Arts Activism"
Type="Non Governmental Organization"
Scope="national"
Average_Rating=""
Number_Of_Ratings="0"
Updated="about 1 year ago"
Score="30"
Avatar="http://www.wiserearth.org/images/icons/org/non_profit_lg.png">
<About><![CDATA[... and beyond the current conflict... ]]></About>
</organization>
</results>
</rsp>
Errors
If your API request was unsuccessful, you can check the HTTP status code to see what sort of error is being returned. Error codes that start in the 400s will be an error on your side, while error codes in the 500s means something went wrong on our server side.Here are some common HTTP error codes you may see in the status code section:
400 Bad Request
Something was wrong with your API request. One reason may be that you passed in a bad parameter value.
404 Not Found
The page with the information you were looking for could not be found. Possible reasons are the masterid was typed in incorrectly, or the search request url was not entered in properly, or the page may have been removed from the WiserEarth directory.
500 Internal Server Error
This message usually means something has gone wrong on our end, likely our database is temporarily not cooperating or that our server might have hit a snag with an unusually high amount of traffic. Send us a message at support@wiserearth.org and note down the time and request sent, and we'll look into it.
503 Service Unavailable
The WiserEarth servers are likely unavailable from a high volume of traffic, or we may have taken them off for maintenance. We'll usually try to post some notification of what's happening and a possible time to retry later when things are back up and running again.
Paging
Paging is the concept of breaking up the information returned into smaller lists. It's the same as when you run a search on a website, i.e. Google, and it shows you only 10 search results per page. That process is also known as "pagination" - breaking up a long list of results in separate pages. For the WiserEarth API, a developer can set the pagerMax parameter to set how many items are returned per page. This means you will be allowed to set if you wanted to see 10 results or 150 results per page. You can also use the page parameter to then jump to a specific page.
We chose a simple model for data paging where page sizes are fixed for any one particular type of data. All listings come to 20 listings a page. Applications should not expect the page size for anyone type of data to stay constant forever, but we also don't plan to change a page size unless we come across a really good reason to do so. Since page sizes are fixed, you only have to supply a page number to pick a cross-section out of a large data response. The default page number for any applicable API method is always 1. For example if you request the list of organizations suppling no parameters, you'll get paging information in your response that looks something like this (sans comments):
"paging": {
"page": 1 // the current page represented
"total": 105 // the total number of loan listings for this call
"page_size": 20 // the number of listings returned per page
"pages": 6 // the total number of pages available
}
Caching
We encourage developers to cache data retrieved from WiserEarth to lessen the load on the servers. We plan on expanding the API to include caching flags which will notify the external applications when cached data has been changed and should be updated.
Getting Data from WiserEarth
The first release of the WiserEarth API is opening up our database to allow developers to make useful applications for the community. This will allow the community to tap into our database of organizations, groups, events, jobs, resources, and solutions.
We'll begin by introducing the data objects that you can request information from, and show some examples of the code you'll be using to make these requests.
Data Objects in the API
I. Organizations
Organizations in WiserEarth must meet 2 key criteria:
1. Must be an organization working in the fields of sustainability or social justice.
2. The work of the organization (based on the mission statement) must be focused on overcoming inequality or environmental harm.
For more information on the criteria used to determine which organizations are listed in the WiserEarth directory, visit our Content Standards page.
There are 14 different types of organization on WiserEarth:
Social Sector Organizations
- Chapter Organizations
- Community Based Organization
- Educational Organization
- Faith Based Organization
- Foundation
- Media Organization
- Network/ Coalition/ Collective
- Non Governmental Organization
- Research Institute
- Student Group/Organization
- UN Organization
- Village Based Organization
- For-profit - i.e. Gray Water Recycling Systems, Carbon Balance Consulting, Zola Goods
- Government Agency - i.e. USDA, EPA, US Fish and Wildlife Service
No matter the organization type, the central theme that ties these organizations together is they are generally oriented toward a cause to promote social justice and/or environmental conservation.
To get information on a specific organization, you have two options:
1) Retrieve the organization by specifying the MasterID (short for Master IDentification)
Every record in the WiserEarth database has a unique ID known as the MasterID for that listing. If you know the MasterID of a record, you can make an API request to get information for specifically that organization.
To find the MasterID, you can look for it at the end of the URL for that record. For example, for organization "Social Actions", the URL on WiserEarth is:
http://www.wiserearth.org/organization/view/856e75c0d7790bc14d8f9e3a6f1cb149
The "856e75c0d7790bc14d8f9e3a6f1cb149" represents the MasterID for organization Social Actions.
Now that you know the MasterID, you can make the below request:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$organizationMasterid = '856e75c0d7790bc14d8f9e3a6f1cb149';
$sig = md5('masterid'.$organizationMasterid.$secret);
$url = 'http://www.wiserearth.org/organizations/'.$organizationMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$organizationXml = curl_exec($ch);
curl_close($ch);
RUBY example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@organizationMasterid = '856e75c0d7790bc14d8f9e3a6f1cb149'
@sig = Digest::MD5.hexdigest('masterid'+@organizationMasterid+@secret)
$url = open('http://www.wiserearth.org/organizations/'+@organizationMasterid+'?sig='+@sig+'&key='+@apiKey)
@organizationXml = uri.read
Alternative example:
User Christophe Mckeon (polypus) has posted up a more idiomatic version of the RUBY request example - note the changes in bold:
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
organization_masterid = '856e75c0d7790bc14d8f9e3a6f1cb149'
sig = Digest::MD5.hexdigest("masterid#{organization_masterid + secret}")
base_url = 'http://www.wiserearth.org/organizations/'
organization_url = "#{base_url}#{organization_masterid}?sig=#{sig}&key=#{api_key}"
organization_xml = open(organization_url).read
You would then get in return the following XML response:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" version="1.0">
<organization
href="http://www.wiserearth.org/organization/view/856e75c0d7790bc14d8f9e3a6f1cb149"
Name="Social Actions"
Type="Network/ Coalition/ Collective"
charity_number=""
Alternate_Name="SocialActions.com"
Website="http://www.socialactions.com"
RSS_Feed_URL="http://feeds2.feedburner.com/about-micro-philanthropy-rss"
Contact_Name="Peter"
Tollfree=""
Fax=""
Location_type="headquarters"
Address="c/o Mobilize.org"
Address2="1133 19th St NW, Floor 9"
City="Washington"
Postal_Code="20036"
State="District of Columbia"
Province=""
Country="United States"
Time_Zone="(EST) Eastern Time (US &amp; Canada)"
Scope="international"
Staff="0"
Volunteers="0"
Members="0"
We_Speak="Englsih"
Language="English"
Created="2009-03-16 19:31:35"
Updated="2009-06-03 18:53:47"
Avatar="http://www.wiserearth.org/images/icons/org/non_profit_lg.png"
Average_Rating="0"
Number_Of_Ratings="0">
<ActivitiesList>
<Activities><![CDATA[Activist]]></Activities>
<Activities><![CDATA[Networking]]></Activities>
</ActivitiesList>
<CertificationsList/>
<SpecialTextList>
<About><![CDATA[<h1 class="title">About Us</h1> ...<p>Social Actions is...]]></About>
</SpecialTextList>
</organization>
</rsp>
2) Perform a search request for the organization
If you don't know the MasterID for the organization, you can try performing a search by keyword instead.
For example, if we are looking for organization "socialactions.com", we could make the below request:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$phrase = 'socialactions.com';
$anchor_lat = '38.9059849';
$anchor_long = '-77.0334179';
$distance = '16093.44';
$sig = md5('phrase'.$phrase.'anchor_lat'.$anchor_lat.'anchor_long'.$anchor_long.'distance'.$distance.$secret);
$url = 'http://www.wiserearth.org/organizations/api_search?phrase=socialactions.com&anchor_lat='.$anchor_lat.'&anchor_long='.$anchor_long.'&distance='.$distance.'&sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$organizationXml = curl_exec($ch);
curl_close($ch);
In return, you would get the following XML response:
<rsp stat="ok" version="1.0">
<results>
<organization href="http://www.wiserearth.org/organization/view/856e75c0d7790bc14d8f9e3a6f1cb149" id="856e75c0d7790bc14d8f9e3a6f1cb149" Name="Social Actions" Website="http://www.socialactions.com" City="Washington" Province="" State="DC" Country="US" Geo_Anchor_Latitude="38.9059849" Geo_Anchor_Longitude="-77.0334179" Geo_Distance="665.79357910156" Geo_Latitude="38.908077" Geo_Longitude="-77.040611" Area="Community Participation,Information and Communication Technology" Updated="5 months ago" Avatar="http://www.wiserearth.org/images/icons/org/non_profit_lg.png">
<About><![CDATA[<h1 class="title">About Us</h1>
<div>
<div class="node node-type-staticpage">
<div class="node-inner">
<div class="content">
<p>Social Actions is a nonprofit initiative based in Canada and the U.S. Our fiscal sponsor is <a href="http://www.mobilize.org/">Mobilize.org</a>. Because our staff and community are all over the world, our headquarters are online.</p>
<p><strong>Mission</strong></p>
<p>We make it easy for you to make a difference.</p>
<p><strong>What We Do</strong></p>
<p>We help you find and share opportunities to change the world. </p>
<ul>
<li>First, we collect ways to get involved in the causes you care about from these 40+ <a href="http://www.socialactions.com/meet-the-platforms">action sources</a>, including Care2, Change.org, DonorsChoose.org, DemocracyinAction, GlobalGiving, Idealist, Kiva, SixDegrees and VolunteerMatch.</li>
</ul><p> </p>
</div></div></div></div>Then, we make it easy for you to find these opportunities by presenting them in a user-friendly search engine.
<p> </p>
We also encourage nonprofits, companies, and third-party developers to create online tools that help you share ways for others to take action on your website, blog, or mobile device.
<p><strong>You can help Social Actions by:</strong></p>
<ul>
<li><a href="http://www.socialactions.com/donate">Donating</a></li>
<li><a href="http://www.socialactions.com/hire-us">Hiring us</a></li>
<li> <a href="http://www.socialactions.com/press/logos-and-badges">Spreading the word</a></li>
<li> <a href="http://blog.socialactions.com/">Joining our community</a></li>
</ul>
<p><strong>Social Actions Team</strong></p>
<p>Peter Deitz, Founder and Executive Director<br /> Christine Egger, Founding Team Member<br /> Joe Solomon, Director of Social Actions' Change the Web Challenge<br /> Josh Crawford (<a href="http://www.brattcollective.com/">Brattleboro Tech Collective</a>), Co-Lead Programmer<br /> Jason Mott (<a href="http://www.brattcollective.com/">Brattleboro Tech Collective</a>), Co-Lead Programmer <br /> Britt Bravo (<a href="http://brittbravo.com/">Big Vision Consulting</a>), Communications Consultant </p>
<p>Read the <a href="http://www.socialactions.com/press/bios">team member bios</a>.</p>
<p> </p>
<p><a name="mentors"></a><strong>Mentors</strong></p>
<p>Kare Anderson, Say It Better<br />Heather Cronk, New Organizing Institute<br />Deborah Elizabeth Finn, Consultant<br />Cynthia Gibson, Consultant<br />Mark Grimes, Ned.com<br />Allen Gunn, Aspiration Tech<br />Phil Klein, Consultant<br />Paul Lamb, Man on a Mission Consulting<br />Tom Munnecke, Uplift Academy<br />Kurt Niedermeier, KN Graphic Design<br />Celine Takatsuno, Consultant<br />Gary Tomchuck, Consultant<br />Amy Sample Ward, NetSquared<br />Kyle Shannon, Internet Pioneer<br />Tom Watson, Changing our World</p>
<p> </p>
<p><strong>Press</strong></p>
<p>Learn more about <a href="http://www.socialactions.com/press">our team and accomplishments to date</a>.</p>
<p> </p>
<p><strong> Partners</strong></p>
<p>Learn more about <a href="http://www.socialactions.com/partners">our media and organizational partnerships</a>.</p>
]]></About>
</organization>
</results>
</rsp>
Alternatively, if you wanted to run a search for organizations without any keyword restrictions, you can do so by removing the keywords parameter in the search request. However, the API does require that you at least specify one parameter in the search request.
As a workaround, we recommend then removing the Keyword parameter, and replacing it with the Language parameter. You can also choose to restrict your search to a specific language by putting a different language code (see our list of Language Codes).
Organization search parameters and response fields can be found here.
II. Groups
Groups on WiserEarth can represent both a formal and informal gathering of people to help organize their work toward a specific cause or issue. A group is different from an organization because an organization page is just a static listing in the directory, whereas a group is a dynamic space where members can interact and collaborate together.
A group can be started by an organization to build its presence on WiserEarth (i.e.: Women's Earth Alliance, Global Fund for Women, Catalytic Communities) or it can be started by individuals looking to bring together other members who share similar interests (i.e. Permaculture Marin, Baltimore Healthy Living Network, Bolinas Community Garden).
As with organizations, you can find information about a group using its MasterID or running a search request in the API.
1) Retrieving by MasterID
MasterIDs for groups are different from other data in that it doesn't show up as string of random numbers and letters. Instead, the group creator can choose the name of their group's MasterID during the creation process. The MasterID is still nonetheless found at the end of the URL for the group, as in the below example for group "Bolinas Community Garden::
If the URL is: http://www.wiserearth.org/group/Bolinascommunitygarden
then the MasterID will be: "Bolinascommunitygarden"
To retrieve information about a group using its MasterID, run the following request:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b'; <replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65'; <replace with your own Secret>
$groupMasterid = 'Bolinascommunitygarden';
$sig = md5('masterid'.$groupMasterid.$secret);
$url = 'http://www.wiserearth.org/groups/'.$groupMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$groupXml = curl_exec($ch);
curl_close($ch);
Ruby example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@groupMasterid = 'Bolinascommunitygarden'
@sig = Digest::MD5.hexdigest('masterid'+@groupMasterid+@secret)
$url = open('http://www.wiserearth.org/groups/'+@groupMasterid+'?sig='+@sig+'&key='+@apiKey)
@groupXml = uri.read
Alternate RUBY example from user Polypus:
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
group_masterid = 'Bolinascommunitygarden'
sig = Digest::MD5.hexdigest("masterid#{group_masterid + secret}")
base_url = 'http://www.wiserearth.org/groups/'
group_url = "#{base_url}#{group_masterid}?sig=#{sig}&key=#{api_key}"
group_xml = open(group_url).read
You would then get in return the following XML file:
(Coming soon - example input in the corresponding XML response)
- Refer to the section below for a more detailed explanation of each field
2) Getting information via a search
To run a search for groups on WiserEarth, you would perform the following request:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$phrase = 'bolinas community garden';
$sig = md5('phrase'.$phrase.$secret);
$url = 'http://www.wiserearth.org/groups/api_search?phrase=bolinas+community+garden&sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$organizationXml = curl_exec($ch);
curl_close($ch);
For a list of other fields you can search by, refer to our Search API fields section.
In return, you would get the following XML response:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" version="1.0">
<results>
<group href="http://www.wiserearth.org/group/Bolinascommunitygarden" id="Bolinascommunitygarden" Name="Bolinas Community Garden" Area="Permaculture,Sustainable Living,Gardening,Community Service/Volunteerism,Youth Education and Empowerment,Composting,Seed Conservation,Sustainability Education,Renewable Energy,Sustainable Building" Tagline="" Updated="8 months ago">
<About><![CDATA[We would like to build a community garden in Bolinas. A place for growing food and skill sharing permaculture and sustainable living skills: water catchment, greywater, composting, compost toilets etc... We need help raising money and putting in the garden once we have a cleared site. The proposed site is to have it behind the BPUD on Elm St. PLEASE let me know if you can get involved.]]></About>
</group>
</results>
</rsp>
Also, if you wanted to just run a search for all groups, you don't have to specify any keywords. However, the API does require you to set at least one parameter, so as a workaround, you could remove the keyword parameter, and instead put in the Language parameter.
We recommend setting the Language parameter to "All" to capture as many search results as possible. If you are looking for results only in a specific language, you can use a different language code. (See our list of language codes)
In the below search request, we are using language code "ALL" to represent all languages:
(Coming soon - example search request for groups with language set to all languages)
You would then get the following XML file in response:
(Coming soon - example of the search results file)
Group Fields
A group listing can have the following fields:
(Coming soon - group fields)
III. Events
The definition of an event is generally understood, so we won't go into any details explaining events. Instead, let's jump straight to how you would retrieve information about an event on WiserEarth.1) Retrieving an event by MasterID
As with organizations, the MasterID of an event can also be found in its URL. For the below event "Bioneers 2009",
If the URL is: http://www.wiserearth.org/event/view/50a7dd2e385685f5a87c5dcb640406c9
Then the MasterID is: 50a7dd2e385685f5a87c5dcb640406c9
To perform a request for an event with the MasterID:
PHP example
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$eventMasterid = '50a7dd2e385685f5a87c5dcb640406c9';
$sig = md5('masterid'.$eventMasterid.$secret);
$url = 'http://www.wiserearth.org/event/'.$eventMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$eventXml = curl_exec($ch);
curl_close($ch);
Ruby example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@eventMasterid = '50a7dd2e385685f5a87c5dcb640406c9'
@sig = Digest::MD5.hexdigest('masterid'+@eventMasterid+@secret)
$url = open('http://www.wiserearth.org/event/'+@eventMasterid+'?sig='+@sig+'&key='+@apiKey)
@eventXml = uri.read
Alternate RUBY example (credit goes to user Polypus):
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
event_masterid = '50a7dd2e385685f5a87c5dcb640406c9'
sig = Digest::MD5.hexdigest("masterid#{event_masterid + secret}")
base_url = 'http://www.wiserearth.org/event/'
event_url = "#{base_url}#{event_masterid}?sig=#{sig}&key=#{api_key}"
event_xml = open(event_url).read
You would then get in return the following XML file:
(Coming soon - example corresponding XML response)
2) Search for an event
To run a search for an event on WiserEarth, you would perform the following request:
(Oz, please enter an example search request for event with keyword "bioneers 2009")
In return, you would get the following XML response:
(Coming soon - example corresponding XML response for performing such a search)
Alternatively, if you wanted to run a search for events without any keyword restrictions, you can do so by removing the keywords parameter in the search request. However, the API does require that you at least specify one parameter in the search request.
As a workaround, we recommend then removing the Keyword parameter, and replacing it with the Language parameter. We recommend setting the Language parameter to "All" to capture as many search results as possible. You can also choose to restrict your search to a specific language by putting a different language code (see our list of Language Codes).
For the below search request, we've removed the Keyword parameter and instead put in Language parameter set to "All" to find events in all languages:
(Coming soon - example of a search request for events with Language parameter set to All)
Event Fields:
(Coming soon - Event fields)
IV. Jobs
The definition of a job is generally understood, so we won't go into any details explaining jobs. Instead, let's jump straight to how you would retrieve information about a job on WiserEarth.
1) Retrieving a job by MasterID
The MasterID of a jobt can also be found in its URL. For the below job "WiserEarth Internships",
If the URL is: http://www.wiserearth.org/job/view/fcd5c2f7a02f0a140182a68b2362de0c
Then the MasterID is: fcd5c2f7a02f0a140182a68b2362de0c
To perform a request for a job with the MasterID:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$jobMasterid = 'fcd5c2f7a02f0a140182a68b2362de0c';
$sig = md5('masterid'.$jobMasterid.$secret);
$url = 'http://www.wiserearth.org/job/'.$jobMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$jobXml = curl_exec($ch);
curl_close($ch);
Ruby example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@jobMasterid = 'fcd5c2f7a02f0a140182a68b2362de0c'
@sig = Digest::MD5.hexdigest('masterid'+@jobMasterid+@secret)
$url = open('http://www.wiserearth.org/job/'+@jobMasterid+'?sig='+@sig+'&key='+@apiKey)
@jobXml = uri.read
Alternate RUBY example (credit goes to user Polypus):
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
job_masterid = 'fcd5c2f7a02f0a140182a68b2362de0c'
sig = Digest::MD5.hexdigest("masterid#{job_masterid + secret}")
base_url = 'http://www.wiserearth.org/job/'
job_url = "#{base_url}#{job_masterid}?sig=#{sig}&key=#{api_key}"
job_xml = open(job_url).read
(Coming soon - example corresponding XML response)
- Refer to the section below for a more detailed explanation of each field
2) Search for a job
To run a search for a job on WiserEarth, you would perform the following request:
(Coming soon - example search request for jobs with keyword "wiserearth internship")
In return, you would get the following XML response:
(Coming soon - example corresponding XML response for performing such a search)
Alternatively, if you wanted to run a search for jobs without any keyword restrictions, you can do so by removing the keywords parameter in the search request. However, the API does require that you at least specify one parameter in the search request.
As a workaround, we recommend then removing the Keyword parameter, and replacing it with the Language parameter. We recommend setting the Language parameter to "All" to capture as many search results as possible. You can also choose to restrict your search to a specific language by putting a different language code (see our list of Language Codes).
For the below search request, we've removed the Keyword parameter and instead put in Language parameter set to "All" to find jobs in all languages:
(Coming soon - example search request for jobs with Language parameter set to All)
Job Fields:
(Coming soon - Job fields)
V. Resources
Resources on WiserEarth can be categorized by the following 8 types:Audio
Article
Blog
Presentation
Video
Website
White paper
Other
Retrieving information about a resource is similar to the requests for the examples we showed above:
1) Retrieving a resource by MasterID
The MasterID of a resource can also be found in its URL. For the below resource "Beyond Grey Pinstripes",
If the URL is: http://www.wiserearth.org/resource/view/45139649dc232e115a723bf4f19d803c
Then the MasterID is: 45139649dc232e115a723bf4f19d803c
To perform a request for a resource with the MasterID:
PHP example:
$apiKey = '670694205349ed6735de86557081cc0b';<replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65';<replace with your own Secret>
$resourceMasterid = '45139649dc232e115a723bf4f19d803c';
$sig = md5('masterid'.$resourceMasterid.$secret);
$url = 'http://www.wiserearth.org/resource/'.$resourceMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$resourceXml = curl_exec($ch);
curl_close($ch);
Ruby example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@resourceMasterid = '45139649dc232e115a723bf4f19d803c'
@sig = Digest::MD5.hexdigest('masterid'+@resourceMasterid+@secret)
$url = open('http://www.wiserearth.org/resource/'+@resourceMasterid+'?sig='+@sig+'&key='+@apiKey)
@resourceXml = uri.read
Alternate RUBY example (credit goes to user Polypus):
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
resource_masterid = '45139649dc232e115a723bf4f19d803c'
sig = Digest::MD5.hexdigest("masterid#{resource_masterid + secret}")
base_url = 'http://www.wiserearth.org/resource/'
resource_url = "#{base_url}#{resource_masterid}?sig=#{sig}&key=#{api_key}"
resource_xml = open(resource_url).read
You would then get in return the following XML file:
(Coming soon - example corresponding XML response)
- Refer to the section below for a more detailed explanation of each field
2) Search for a resource
To run a search for a resource on WiserEarth, you would perform the following request:
(Oz, please enter an example search request for solution with keyword "beyond grey pinstripes")
In return, you would get the following XML response:
(Coming soon - example XML response for performing such a search)
Alternatively, if you wanted to run a search for resources without any keyword restrictions, you can do so by removing the keywords parameter in the search request. However, the API does require that you at least specify one parameter in the search request.
As a workaround, we recommend then removing the Keyword parameter, and replacing it with the Language parameter. We recommend setting the Language parameter to "All" to capture as many search results as possible. You can also choose to restrict your search to a specific language by putting a different language code (see our list of Language Codes).
For the below search request, we've removed the Keyword parameter and instead put in Language parameter set to "All" to find resources in all languages:
(Coming soon - example of a search request for resources with Language parameter set to All)
Resource Fields:
(Coming soon - Resource Fields)
VI. Solutions
Solutions are good practices that address issues that are facing the world today. Members of the WiserEarth community are encouraged to share their ideas, particularly practices that have been codified in toolkits or manuals and have proven to be successful.
Retrieving information about a solution is similar to the requests for the examples we showed above:
1) Retrieving a solution by MasterID
The MasterID of a solution can also be found in its URL. For the below solution "Designing and Operating Effective Networks",
If the URL is: http://www.wiserearth.org/solution/view/cb257a450f0b1fdd213f2f0227b23794
Then the MasterID is: cb257a450f0b1fdd213f2f0227b23794
To perform a request for a solution with the MasterID:
PHP Example:
$apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
$secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
$solutionMasterid = '800f18f66ac105ba42b83b781e7bfba5';
$sig = md5('masterid'.$solutionMasterid.$secret);
$url = 'http://www.wiserearth.org/solutions/'.$solutionMasterid.'?sig='.$sig.'&key='.$apiKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$solutionXml = curl_exec($ch);
curl_close($ch);
Ruby example:
@apiKey = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
@secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
@solutionMasterid = '800f18f66ac105ba42b83b781e7bfba5'
@sig = Digest::MD5.hexdigest('masterid'+@solutionMasterid+@secret)
$url = open('http://www.wiserearth.org/solutions/'+@solutionMasterid+'?sig='+@sig+'&key='+@apiKey)
@solutionXml = uri.read
Alternate RUBY example (credit goes to user Polypus):
require 'digest/md5'
require 'open-uri'
api_key = '670694205349ed6735de86557081cc0b' <replace with your own API Key>
secret = '85ebb64263b2ea4acc96b40853414e65' <replace with your own Secret>
solution_masterid = '800f18f66ac105ba42b83b781e7bfba5'
sig = Digest::MD5.hexdigest("masterid#{solution_masterid + secret}")
base_url = 'http://www.wiserearth.org/solution/'
solution_url = "#{base_url}#{solution_masterid}?sig=#{sig}&key=#{api_key}"
solution_xml = open(solution_url).read
You would then get in return the following XML file:
(Coming soon - example corresponding XML response)
- Refer to the section below for a more detailed explanation of each field
2) Search for a solution
To run a search for a solution on WiserEarth, you would perform the following request:
(Coming soon - search request for solution with keyword "designing and operating effective networks")
In return, you would get the following XML response:
(Coming soon - corresponding XML response for performing such a search)
Alternatively, if you wanted to run a search for solutions without any keyword restrictions, you can do so by removing the keywords parameter in the search request. However, the API does require that you at least specify one parameter in the search request.
As a workaround, we recommend then removing the Keyword parameter, and replacing it with the Language parameter. We recommend setting the Language parameter to "All" to capture as many search results as possible. You can also choose to restrict your search to a specific language by putting a different language code (see our list of Language Codes).
For the below search request, we've removed the Keyword parameter and instead put in Language parameter set to "All" to find solutions in all languages:
(Coming soon - search request for solutions with Language parameter set to All)
Solution Fields:
(Coming soon - Solution Fields)
Terminology
Call - a method of communication between the API and the server, where the API sends a call to the server requesting information
Client - refers to the application built by the developer to request or send information to the API. One example of a client would be an iphone application that grabs data from WiserEarth and displays it within the application.
REST - acronym for Representational State Transfer. Represents an architectural style for large-scale software design. Much of the world wide web is built along REST principles
RESTful - a style of architecture that follows generally along REST principles, but will make modifications as needed that may not necessarily adhere to the formal rules of REST architecture
MASTERID - the unique identification phrase (consisting of both numbers and letters) that refers to a specific record listing (i.e. an organization page, a job posting, an event listing, etc). Every record in WiserEarth has a MasterID.
URL - acronym for Uniform Resource Locater. Refers to the address of a webpage on the internet (i.e. http://www.wisereath.org/...)
URI - Short for Uniform Resource Identifier, the generic term for all types of names and addresses that refer to objects on the World Wide Web. A URL is one type of a URI. (Webopedia)
XML - Short for Extensible Markup Language, a specification developed by the W3C. XML is a pared-down version of SGML, designed especially for Web documents. It allows designers to create their own customized tags, enabling the definition, transmission, validation, and interpretation of data between applications and between organizations
JSON - JavaScript Object Notation, JSON is a lightweight data-interchange format that is easy for humans to read and write, and for machines to parse and generate. JSON is based on the object notation of the JavaScript language. However, it does not require JavaScript to read or write because it is a text format that is language independent
HTTP GET - a GET request sends a request to the website/server requesting information to be retrieved. The opposite of a GET request would be a POST
HTTP POST - a POST submits data to be processed to the website/server. The API currently does not yet support POST submissions, but we do plan on adding this feature on in the near future
Symfony - Symfony is a web application framework written in PHP which follows the model-view-controller (MVC) paradigm. Symfony is free software released under the MIT license and helps speed up the creation and maintenance of web applications, reducing the number of repetitive coding tasks.
API - an application programming interface (API) is an interface that defines the ways by which an application program may request services from libraries and/or operating system. For a more detailed explanation, we recommend this "HowStuffWorks" article - http://communication.howstuffworks.com/how-to-leverage-an-api-for-conferencing1.htm
API key - An application programing interface key (API key) is a code generated by websites that allow users to access their Application programming interface. API keys can also be used to track how the API is being used in order to prevent malicious use or abuse of the terms of service. (Wikipedia)
Signature code - A signature code is the corresponding phrase associated with each API key. You will receive this code when you sign for an API key. Both the API key and Signature code are needed to authorize an API request
API parameters
apiKeysecret
solutionMasterid
organizationMasterid
groupsMasterid
organizationMasterid
pagerMax
page
(Coming soon - more parameters)
API Search Parameters
- phrase - keywords to search for
- Boolean operators supported
- language
-
Value Description (empty) All EN English AR Arabic ZH Chinese FR French DE German HI Hindi NL Indonesian IT Italian JP Japanese PT Portuguese RU Russian ES Spanish
-
Geolocation Search Parameters:
* = required
- Parameters - Geolocation search parameters are only available when searching for the following entities: Jobs, Events, and Organizations. All 3 fields must be present for the geolocation search to execute successfully.
- anchor_lat *
- latitude decimal value of the coordinate you wish to search around.
- search engine expects coordinate value to be in degrees (as opposed to radians).
- anchor_long *
- longitude decimal value of the coordinate you wish to search around.
- search engine expects coordinate value to be in degrees (as opposed to radians).
- distance *
- the radius of how far you want to search around your anchor coordinate.
- search engine expects value to be in meters.
- anchor_lat *
- Fields - Geolocation search fields will appear for search results that were part of a successfully executed geolocation search.
- Geo_Anchor_Latitude
- latitude decimal value of the coordinate you searched around in degrees
- Geo_Anchor_Longitude
- latitude decimal value of the coordinate you searched around in degrees
- Geo_Distance
- distance of current entity record from anchor coordinate (in meters)
- Geo_Latitude
- latitude decimal value (in degrees) of the current entity record
- Geo_Longitude
- longitude decimal value (in degrees) of the current entity record
- Geo_Anchor_Latitude
Solutions:
- Parameters
- phrase (see global search parameters)
- language (see global search parameters)
- Fields Returned
- href
- id
- Name
- Website
- Tagline
- Updated
- Reviews
- Avatar
- SpecialTextList
- Problem
- Action
Events:
- Parameters
- phrase (see global search parameters)
- language
- anchor_lat, anchor_long, distance (see geolocation search parameters)
- event_type
-
Value Description (empty) All * 30 Conference 40 Cultural/Community 90 Lecture/Talk 160 Meeting 110 Movie 150 Workshop/Training 170 Other
-
- date_scope†
-
Value Description (empty) All dates * 7 All dates 0 All future dates 1 Today 2 This weekend 3 Next weekend 4 Next 7 days 5 Next 30 days 6 In the past
-
- date†
- syntax: date[month]=(1-12)&date[day]=(1-31)&date[year]=(1-3000)
- example: April 23rd, 2010 => date[month]=4&date[day]=23&date[year]=2010
- language (see global search parameters)
- † = date and date_scope are mutually exclusive, you may only specify one. If you specify both, the latter parameter will be used.
- Fields Returned
- href
- id
- name
- city
- province
- state
- country
- area
- start_time
- end_time
- posted
- geolocation search fields
Resources:
- Parameters
- phrase
- language
- resource_type
-
Value Description (empty) All 16 Article 26 Audio 27 Blog 3 Book 4 Presentation 28 Video 21 Website 11 White Paper 25 Other
-
- Fields
- href
- id
- name
- website
- country
- area
- author
- updated
- about
Groups:
- Parameters
- phrase
- language
- geolocation search parameters
- Fields
- href
- id
- name
- area
- tagline
- updated
- about
Jobs:
- Parameters
- phrase
- employer_name
- job_type
-
Value Description (empty) All 2 Employee 3 Contractor 1 Volunteer 5 Intern 4 Other
-
- language
- anchor_lat, anchor_long, distance (see geolocation search parameters)
- Fields
- href
- id
- name
- employer_name
- city
- province
- state
- country
- area
- updated
- about
- geolocation search fields
- Parameters
- phrase
- language
- org_type
-
Value Description (empty) All 12 Chapter Organization 3 Community Based Organization 6 Education Based Organization 9 Faith Based Organization 13 For-Profit 5 Foundation 14 Government Agency 8 Media Organization 4 Network / Coalition / Collective 1 Non-Government Organization 7 Research Institute 11 Student Group / Organization 10 UN Organization 2 Village Based Organization
-
- anchor_lat, anchor_long, distance (see geolocation search parameters)
- Fields
- href
- id
- name
- website
- city
- province
- state
- country
- area
- updated
- avatar
- about
- geolocation search fields
EN = English
FR = France
ES = Spanish
AR = Arabic
ZH = Chinese
DE = German
HI = Hindi
NL = Indonesian | Bahasa
IT = Italian
JP = Japanese
PT = Portuguese
RU = Russian
Search request API strings:
http://www.wiserearth.org/organizations/api_search?r=1&language=EN&sig=<6b1bf68f0df95ae9556b3e23e8d30218>&key=<72ba0452eb1390086cb8ddcb4d5d00b9>
http://www.wiserearth.org/solution/api_search?r=1&language=EN&sig=<6b1bf68f0df95ae9556b3e23e8d30218>&key=<72ba0452eb1390086cb8ddcb4d5d00b9>
http://www.wiserearth.org/job/api_search?r=1&language=EN&sig=<6b1bf68f0df95ae9556b3e23e8d30218>&key=<72ba0452eb1390086cb8ddcb4d5d00b9>
http://www.wiserearth.org/event/api_search?r=1&language=EN&sig=<6b1bf68f0df95ae9556b3e23e8d30218>&key=<72ba0452eb1390086cb8ddcb4d5d00b9>
http://www.wiserearth.org/groups/api_search?r=1&language=EN&sig=<6b1bf68f0df95ae9556b3e23e8d30218>&key=<72ba0452eb1390086cb8ddcb4d5d00b9>


