ASP Example

The following example does not set an Accept header, therefore, the response is returned in the default XML format.

Sample Request

The following code calls the Get All Projects API operation that retrieves information for all projects.

   
                  <%@ Language="JScript"%>
                  <%
                  // GET all projects full information - NOTE: must iterate over results using &nextProjectId={some id} query string parameter as response only returns 10 projects at a time
                  var url = "https://api.globalgiving.org/api/public/projectservice/all/projects?api_key=YOUR_API_KEY";
                  
                  var request = Server.CreateObject("Msxml2.ServerXMLHTTP");
                  request.open("GET", url, false);
                  request.send();
                   
                  var statusCode = request.status;
                  var output = request.responseText;
                  //output any errors
                  switch (statusCode) 
                  {
                     case 200:
                     //Success
                     break;
                     case 503:
                     output = "Service unavailable.\n\n" + output;
                     break;
                     case 500:
                     output = "Internal Server Error.\n\n" + output;
                     break;
                     case 401:
                     output = "Unauthorized. You do not have permission to access this resource.\n\n" + output;
                     break;
                     case 403:
                     output = "Forbidden. You do not have permission to access this resource.\n\n" + output;
                     break;
                     case 400:
                     output = "Bad request.\n\n" + output;
                     break;
                     default:
                     output = "Unexpected HTTP status of: " + statusCode + ".\n\n" + output;
                  }
                   
                  // outputting results as plain text
                  Response.ContentType = "text/plain";
                  Response.AddHeader("Content-Disposition", "inline");
                  Response.Write(output);
                  %>
               

Sample Response

   
               <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
               <projects>
                 <hasNext>true</hasNext>
                 <nextProjectId>364</nextProjectId>
                 <project>
                    <active>true</active>
                    <activities>Literacy, English, and income-generating skills classes are offered at the Women’s Learning Center in Sar Asia and serve about 540 women per month. The clinic in Jaghartun provides over 2,500 patients per month with medical care and health education.</activities>
                    <approvedDate>2006-10-11T17:21:55-07:00</approvedDate>
                    <contactAddress>Creating Hope International</contactAddress>
                    <contactAddress2>P. O. Box 1058</contactAddress2>
                    <contactCity>Dearborn</contactCity>
                    <contactCountry>United States</contactCountry>
                    <contactEmail>CHI@creatinghope.org</contactEmail>
                    <contactName>Toc Dunlap</contactName>
                    <contactPhone>(313) 278-5806</contactPhone>
                    <contactPostal>48121</contactPostal>
                    <contactState>Michigan</contactState>
                    <contactTitle>President</contactTitle>
                    <contactUrl>https://www.creatinghope.org</contactUrl>
                    <country>Afghanistan</country>
                    <iso3166CountryCode>AF</iso3166CountryCode>
                    <donationOptions>
                     <donationOption>
                         <amount>25</amount>
                         <description>15 women will learn to read.</description>
                     </donationOption>
                     <donationOption>
                         <amount>50</amount>
                         <description>5 women have cloth and tools for the tailoring course.</description>
                     </donationOption>
                     <donationOption>
                         <amount>75</amount>
                         <description>42 women receive basic health care and health education.</description>
                     </donationOption>
                    </donationOptions>
                    <funding>3908.0</funding>
                    <goal>7260</goal>
                    <id>354</id>
                    <imageLink>https://www.globalgiving.org/pfil/354/pict.jpg</imageLink>
                    <longTermImpact>A full array of medical and educational services are offered to hard-to-reach rural women and girls through Women’s Learning Center sites at Jaghartun and Sar Asia. These centers improve the education and health of Afghan women in the region.</longTermImpact>
                    <need>No education has been available to women and girls in the western province of Herat, Afghanistan, for the last decade under the Taliban regime. Project partner AIL began offering Women’s Learning Centers to women and girls in rural Herat during 2003. These health and education services at Sar Asia and Jaghartun include a maternal/child health clinic, literacy and skills training classes. This project will ensure continuation of these urgently needed, accessible, culturally sensitive services.</need>
                    <numberOfDonations>33</numberOfDonations>
                    <progressReportLink>https://www.globalgiving.org/pr/400/proj354a.html#progressReports </progressReportLink>
                    <projectLink>https://www.globalgiving.org/pr/400/proj354a.html</projectLink>
                    <region>Asia and Oceania</region>
                    <remaining>3352.0</remaining>
                    <status>active</status>
                    <summary>Empowering rural Afghan women and girls in Sar Asia and Jaghartun, Herat, through education and training opportunities as well as health and reproductive health services.</summary>
                    <themeName>Education</themeName>
                    <title>Learning Centers for Rural Women in Herat</title>
                   </project>
                   .
                   .
                   <project>
                    ......
                   </project>
               </projects>