0
Answered

2 questions that are important for me to know about api rest for Shabbat times

Mmf 3 years ago updated by Michael J. Radwin 3 years ago 3

1) Is it constant that in set 0 it is candle lighting and in set 2 it is Shabbat departure?


Array

(

[title] => Hebcal Jerusalem January 2021

[date] => 2021-01-17T13:08:58.174Z

[location] => Array

(

[title] => Jerusalem, Israel

[city] => Jerusalem

[tzid] => Asia/Jerusalem

[latitude] => 31.76904

[longitude] => 35.21633

[cc] => IL

[country] => Israel

[admin1] => Jerusalem

[geo] => geoname

[geonameid] => 281184

)

[items] => Array

(

[0] => Array

(

[title] => Candle lighting: 16:22

[date] => 2021-01-22T16:22:00+02:00

[category] => candles

[title_orig] => Candle lighting

[hebrew] => הדלקת נרות

)

[1] => Array

(

[title] => Parashat Bo

[date] => 2021-01-23

[category] => parashat

[hebrew] => פרשת בא

[leyning] => Array

(

[1] => Exodus 10:1 - 10:11

[2] => Exodus 10:12 - 10:23

[3] => Exodus 10:24 - 11:3

[4] => Exodus 11:4 - 12:20

[5] => Exodus 12:21 - 12:28

[6] => Exodus 12:29 - 12:51

[7] => Exodus 13:1 - 13:16

[torah] => Exodus 10:1-13:16

[haftarah] => Jeremiah 46:13 - 46:28

[maftir] => Exodus 13:14 - 13:16

)

[link] => https://www.hebcal.com/sedrot/bo-20210123?i=on&utm_source=js&utm_medium=api

)

[2] => Array

(

[title] => Havdalah: 17:42

[date] => 2021-01-23T17:42:00+02:00

[category] => havdalah

[title_orig] => Havdalah

[hebrew] => הבדלה

)

)

)

2) Is it regular that I access the link https://www.hebcal.com/shabbat?cfg=json&geo=city&city=IL-Jerusalem so he will show me the details of the upcoming Shabbat that week that I access the link?


I would love to get an answer soon. Thanks

Answer

+2
Answer
Answered

Hi, thanks for using Hebcal!


1) Is it constant that in set 0 it is candle lighting and in set 2 it is Shabbat departure?

No. When there are other holidays such as Rosh Chodesh or Pesach or Purim, these will also be present in the items array.

For Shabbat candle-lighting, you must loop through items array, looking for an item that has category == candles and a date that is on Friday.

For Havdalah, you must loop through items array, looking for an item that has category == havdalah and a date that is on Saturday.

2) Is it regular that I access the link https://www.hebcal.com/shabbat?cfg=json&geo=city&city=IL-Jerusalem so he will show me the details of the upcoming Shabbat that week that I access the link?

Yes, that URL will work correctly every week, regardless of when you access it during the week. On Sunday at 00:00 (midnight) it will refresh to the new week's events.

If you just look for category matching candles or havdalah and don't check the date, then you'll also include candle-lighting and havdalah events for major holidays like Pesach.


For example, here's what the output will look like for the week leading up to Pesach

https://www.hebcal.com/shabbat?city=Jerusalem&cfg=json&gy=2021&gm=3&gd=24

thank you very much. But if I want only for Saturdays and holidays of lighting candles and havdalah, then it is enough just to put a first condition that if it is a candle lighting then he will print the date, and a second condition if it is a havdalah then also print the date and then connect the two?!. Or can it be confusing if there is a Shabbat and a holiday together in the middle of the week!? (Of course I am only talking about Jerusalem for now)

thank you! 

+2
Answer
Answered

Hi, thanks for using Hebcal!


1) Is it constant that in set 0 it is candle lighting and in set 2 it is Shabbat departure?

No. When there are other holidays such as Rosh Chodesh or Pesach or Purim, these will also be present in the items array.

For Shabbat candle-lighting, you must loop through items array, looking for an item that has category == candles and a date that is on Friday.

For Havdalah, you must loop through items array, looking for an item that has category == havdalah and a date that is on Saturday.

2) Is it regular that I access the link https://www.hebcal.com/shabbat?cfg=json&geo=city&city=IL-Jerusalem so he will show me the details of the upcoming Shabbat that week that I access the link?

Yes, that URL will work correctly every week, regardless of when you access it during the week. On Sunday at 00:00 (midnight) it will refresh to the new week's events.