Formatting url to search for specific verses

Discussions about the Notes and Journal tool on LDS.org. This includes the Study Toolbar as well as the scriptures and other content on LDS.org that is integrated with Notes and Journal.
corwinslack
New Member
Posts: 47
Joined: Tue Nov 22, 2011 12:34 pm

Formatting url to search for specific verses

Postby corwinslack » Sun Dec 10, 2017 9:28 pm

If I know the verse I want to find how do I format the url? I am trying to code the url in another app.
(E.g. I input 1:Cor. 1:21-25 and the search returns that page with the reference highlighted and a well formed url to paste into a hyperlink.
Thanks

User avatar
sbradshaw
Senior Member
Posts: 4443
Joined: Mon Sep 26, 2011 8:42 pm
Location: Provo, UT
Contact:

Re: Formatting url to search for specific verses

Postby sbradshaw » Wed Dec 13, 2017 12:42 pm

This is the current format for scripture references:
https://www.lds.org/scriptures/nt/1-cor/1?verse=21-25&lang=eng#p21

  • https://www.lds.org OR gospellibrary://content – LDS.org or the Gospel Library app.
  • /scriptures – section of LDS.org or content type.
  • /nt – testament / work / volume of scripture (ot / nt / bofm / dc-testament / pgp).
  • /1-cor – scripture book.
  • /1 – chapter.
  • ?verse=21-25 – verse(s) to put a callout box around, optional. If not specified, no callout boxes will be drawn. This can be a single verse, a range, or a series (for example, "2-5,7" is valid).
  • &lang=eng – language, optional. If not specified, link will default to the browser/device language (which could give an error if the content doesn't exist in that language).
  • #p21 – verse to scroll to, optional. If not specified, chapter will load to the top.
Samuel Bradshaw • If you desire to serve God, you are called to the work.

corwinslack
New Member
Posts: 47
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

Postby corwinslack » Wed Dec 13, 2017 2:03 pm

If you go to scriptures.lds.org you can see a field that allows search criteria. If you entered 1 Cor. 1:22-25 in that field it would navigate to a url very similar to what you defined. I want to know how to format a url to feed the form not how to format the url it finds. I suppose it will have a GET in it but my skills at HTML queries are inadequate.

User avatar
sbradshaw
Senior Member
Posts: 4443
Joined: Mon Sep 26, 2011 8:42 pm
Location: Provo, UT
Contact:

Re: Formatting url to search for specific verses

Postby sbradshaw » Wed Dec 13, 2017 2:46 pm

If you go to LDS.org/scriptures, then disconnect your internet connection (to prevent redirects), then type a reference in the scriptures search box and press enter, you can see what URL the form tries to load. For 1 Cor. 1:21–25, this is what I got in the address bar:
https://www.lds.org/scriptures/search?lang=eng&query=1+Cor.+1%3A21–25&x=0&y=0

I'm not sure what the x and y parameters do – I think they can be removed. So:
https://www.lds.org/scriptures/search?lang=eng&query=[url-encoded scripture reference]
Samuel Bradshaw • If you desire to serve God, you are called to the work.

corwinslack
New Member
Posts: 47
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

Postby corwinslack » Wed Dec 13, 2017 3:34 pm

This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".

I am trying to get the system to perform the URL formatting for me.

User avatar
sbradshaw
Senior Member
Posts: 4443
Joined: Mon Sep 26, 2011 8:42 pm
Location: Provo, UT
Contact:

Re: Formatting url to search for specific verses

Postby sbradshaw » Wed Dec 13, 2017 3:50 pm

What are you hoping for it to return? A JSON file of some sort?
Samuel Bradshaw • If you desire to serve God, you are called to the work.

eblood66
Senior Member
Posts: 3183
Joined: Mon Sep 24, 2007 8:17 am
Location: Cumming, GA, USA

Re: Formatting url to search for specific verses

Postby eblood66 » Wed Dec 13, 2017 4:08 pm

corwinslack wrote:This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".

I am trying to get the system to perform the URL formatting for me.

Based on the query parameters the form should be something like this (I haven't tested this so the it may be missing details but the gist should be right):

Code: Select all

<form action="https://www.lds.org/scriptures/search" method="get">
  <input type="hidden" name="lang" value="eng"></input>
  <input type="text" name="query"></input>
</form>

corwinslack
New Member
Posts: 47
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

Postby corwinslack » Wed Dec 13, 2017 4:45 pm

Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?

corwinslack
New Member
Posts: 47
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

Postby corwinslack » Wed Dec 13, 2017 4:48 pm

Would it be something like

<input type="text" name="query" value="1 Cor. 1:21-24"></input>

eblood66
Senior Member
Posts: 3183
Joined: Mon Sep 24, 2007 8:17 am
Location: Cumming, GA, USA

Re: Formatting url to search for specific verses

Postby eblood66 » Wed Dec 13, 2017 4:49 pm

corwinslack wrote:Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?

Only one of those fields will show up on the screen (name="query" type="text"). That's the one where the input string is entered. The other (name="lang") is hidden and is just there to add the language to the URL.


Return to “Notes and Journal, and Online Scriptures”

Who is online

Users browsing this forum: No registered users and 0 guests