Stake and Ward API

Discussions around miscellaneous technologies and projects for the general membership.
tjallred
New Member
Posts: 9
Joined: Sat Jun 02, 2007 12:06 am
Location: Irvine, California
Contact:

Stake and Ward API

Postby tjallred » Thu Oct 15, 2009 11:00 am

I'm creating a website geared towards members of the Church that would
allow registered users to optionally specify their Stake/Mission and Ward/Branch.

Is there any sort of web service (REST/SOAP/XML/screen scraping) that I could use to let users pick their stake/mission and ward/branch?

Trevor

RossEvans
Senior Member
Posts: 1346
Joined: Wed Jun 11, 2008 8:52 pm
Location: Austin TX
Contact:

Postby RossEvans » Thu Oct 15, 2009 11:15 am

tallred wrote:I'm creating a website geared towards members of the Church that would
allow registered users to optionally specify their Stake/Mission and Ward/Branch.

Is there any sort of web service (REST/SOAP/XML/screen scraping) that I could use to let users pick their stake/mission and ward/branch?


There is no API.

The only thing I can think of is that you could make the user enter their LDS Account username and password, and log them into LUWS. Technically you then could scrape the screens to harvest the names of their units.

If all you do with the harvested data is handled client-side, that might be okay policywise. But I think harvesting anything from LUWS and storing it on your server would be coloring outside the lines.

russellhltn
Community Administrator
Posts: 20781
Joined: Sat Jan 20, 2007 2:53 pm
Location: U.S.

Postby russellhltn » Thu Oct 15, 2009 12:33 pm

I'd be leery about giving my LDS Account information to a non-church server. I'd have no idea what's being done.
Have you searched the Wiki?
Try using a Google search by adding "site:tech.lds.org/wiki" to the search criteria.

User avatar
Mikerowaved
Community Moderators
Posts: 3133
Joined: Sun Dec 23, 2007 12:56 am
Location: Layton, UT

Postby Mikerowaved » Thu Oct 15, 2009 12:51 pm

Not exactly an API, but you could bounce the user-supplied info off of HERE to get the actual links to their stake/ward websites.
So we can better help you, please edit your Profile to include your general location.

tjallred
New Member
Posts: 9
Joined: Sat Jun 02, 2007 12:06 am
Location: Irvine, California
Contact:

Postby tjallred » Thu Oct 15, 2009 4:39 pm

I'll have to change this as soon as the Church changes their search screen, but it works for now. Thanks Mikerowaved for the idea.

Code: Select all

public class ScreenScraper {
   private static String LDS_SEARCH = "http://www.lds.org/units/find/search/1,16055,2311-1,00.html";
   
   static public List<Account> findStakes(String unitName) {
      List<Account> results = new ArrayList<Account>();
      
      String url = LDS_SEARCH + "?unitName=" + unitName;

      Source source = null;
      try {
         source = new Source(new URL(url));
      } catch (MalformedURLException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      if (source == null)
         return results;
      
      List<Element> allElements = source.getAllElements(HTMLElementName.A);
      for (Element element : allElements) {
         String link = element.getAttributeValue("href");
         Account account = new Account();
         account.setName(element.getContent().toString());
         account.setDescription(link);
         if (link.contains("secure.lds.org/units/stake")) {
            account.setType(AccountType.Stake);
            results.add(account);
         }
         if (link.contains("secure.lds.org/units/home")) {
            account.setType(AccountType.Ward);
            results.add(account);
         }
      }
      
      return results;
   }
}


Return to “Other Member Technologies”

Who is online

Users browsing this forum: No registered users and 1 guest