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 = "";
                  var request = Server.CreateObject("Msxml2.ServerXMLHTTP");
        "GET", url, false);
                  var statusCode = request.status;
                  var output = request.responseText;
                  //output any errors
                  switch (statusCode) 
                     case 200:
                     case 503:
                     output = "Service unavailable.\n\n" + output;
                     case 500:
                     output = "Internal Server Error.\n\n" + output;
                     case 401:
                     output = "Unauthorized. You do not have permission to access this resource.\n\n" + output;
                     case 403:
                     output = "Forbidden. You do not have permission to access this resource.\n\n" + output;
                     case 400:
                     output = "Bad request.\n\n" + output;
                     output = "Unexpected HTTP status of: " + statusCode + ".\n\n" + output;
                  // outputting results as plain text
                  Response.ContentType = "text/plain";
                  Response.AddHeader("Content-Disposition", "inline");

Sample Response

               <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                    <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>
                    <contactAddress>Creating Hope International</contactAddress>
                    <contactAddress2>P. O. Box 1058</contactAddress2>
                    <contactCountry>United States</contactCountry>
                    <contactName>Toc Dunlap</contactName>
                    <contactPhone>(313) 278-5806</contactPhone>
                         <description>15 women will learn to read.</description>
                         <description>5 women have cloth and tools for the tailoring course.</description>
                         <description>42 women receive basic health care and health education.</description>
                    <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>
                    <progressReportLink> </progressReportLink>
                    <region>Asia and Oceania</region>
                    <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>
                    <title>Learning Centers for Rural Women in Herat</title>