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
Member
Posts: 54
Joined: Tue Nov 22, 2011 12:34 pm

Formatting url to search for specific verses

#1

Post by corwinslack »

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
Community Moderators
Posts: 6252
Joined: Mon Sep 26, 2011 9:42 pm
Location: Utah
Contact:

Re: Formatting url to search for specific verses

#2

Post by sbradshaw »

This is the current format for scripture references:
https://www.lds.org/scriptures/nt/1-cor ... ng=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
Member
Posts: 54
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

#3

Post by corwinslack »

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
Community Moderators
Posts: 6252
Joined: Mon Sep 26, 2011 9:42 pm
Location: Utah
Contact:

Re: Formatting url to search for specific verses

#4

Post by sbradshaw »

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?l ... 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
Member
Posts: 54
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

#5

Post by corwinslack »

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
Community Moderators
Posts: 6252
Joined: Mon Sep 26, 2011 9:42 pm
Location: Utah
Contact:

Re: Formatting url to search for specific verses

#6

Post by sbradshaw »

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: 3907
Joined: Mon Sep 24, 2007 9:17 am
Location: Cumming, GA, USA

Re: Formatting url to search for specific verses

#7

Post by eblood66 »

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
Member
Posts: 54
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

#8

Post by corwinslack »

Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?
corwinslack
Member
Posts: 54
Joined: Tue Nov 22, 2011 12:34 pm

Re: Formatting url to search for specific verses

#9

Post by corwinslack »

Would it be something like

<input type="text" name="query" value="1 Cor. 1:21-24"></input>
eblood66
Senior Member
Posts: 3907
Joined: Mon Sep 24, 2007 9:17 am
Location: Cumming, GA, USA

Re: Formatting url to search for specific verses

#10

Post by eblood66 »

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.
Post Reply

Return to “Notes and Journal, and Online Scriptures”