Stake and Ward API

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

Stake and Ward API

#1

Post by tjallred »

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: 1345
Joined: Wed Jun 11, 2008 9:52 pm
Location: Austin TX
Contact:

#2

Post by RossEvans »

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: 34475
Joined: Sat Jan 20, 2007 2:53 pm
Location: U.S.

#3

Post by russellhltn »

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 Help Center? Try doing a Google search and adding "site:churchofjesuschrist.org/help" to the search criteria.

So we can better help you, please edit your Profile to include your general location.
User avatar
Mikerowaved
Community Moderators
Posts: 4739
Joined: Sun Dec 23, 2007 12:56 am
Location: Layton, UT

#4

Post by Mikerowaved »

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 1:06 am
Location: Irvine, California
Contact:

#5

Post by tjallred »

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;
	}
}
Post Reply

Return to “Other Member Technologies”