Page 1 of 2
Formatting url to search for specific verses
Posted: Sun Dec 10, 2017 9:28 pm
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
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 12:42 pm
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.
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 2:03 pm
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.
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 2:46 pm
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]
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 3:34 pm
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.
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 3:50 pm
by sbradshaw
What are you hoping for it to return? A JSON file of some sort?
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 4:08 pm
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>
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 4:45 pm
by corwinslack
Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 4:48 pm
by corwinslack
Would it be something like
<input type="text" name="query" value="1 Cor. 1:21-24"></input>
Re: Formatting url to search for specific verses
Posted: Wed Dec 13, 2017 4:49 pm
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.