Getting just the parshat hashavua from a Hebrew or gregorian date using REST API
I was wondering if there is a way to get just the Parshat Hashavua for a given hebrew or gregorian date, the way it tells you that info when you go to the date converter https://www.hebcal.com/converter/
I ask because I made a google doc that if you input an Gregorian date it will tell you when the earliest Gregorian date is for a bar or bat mitzvah:
https://docs.google.com/spreadsheets/d/1_F1qHbJsZTLk6p8_QYWha7dnlcEHokuMHA1Rjx3nMqI/edit#gid=539710776
and I was wondering if I can also easily get another column to be the parsha for that date
Answer
The XML version now includes the parashat haShavua.
https://www.hebcal.com/converter/?cfg=xml&gd=28&gm=12&gy=2015&g2h=1
<hebcal> <gregorian year="2015" month="12" day="28"/> <hebrew year="5776" month="Tevet" day="16" str="ט״ז בְּטֵבֵת תשע״ו"/> <events> <event name="Parashat Shemot" href="http://www.hebcal.com/sedrot/shemot"/> </events> </hebcal>
Thanks!
I switched to XML, because google docs natively supports XML but needs help supporting JSON. I assume you have a reason for only reporting the parsha in JSON, but not XML.
Thanks for reminding me that it is given in JSON!
The Hebrew Date Converter REST API already supports this.
https://www.hebcal.com/home/219/hebrew-date-converter-rest-api
For example, if you use this URL
http://www.hebcal.com/converter/?cfg=json&hy=5749&hm=Kislev&hd=25&h2g=1
You will get this response:
{"gy": 1988,"gm": 12,"gd": 4,"hy": 5749,"hm": "Kislev","hd": 25,"hebrew": "כ״ה בְּכִסְלֵו תשמ״ט","events": ["Parashat Miketz","Chanukah: 2 Candles"]}
Notice that the Parashat haShavuah is contained in the events array.
The two issues I had with that are:
1) It gives all the aliyot readings according to triennial and annual cycle, which is so much more data than I need, even if I restrict it only to the month of interest
2) I would have to calculate if the date is shabbat and if it is then take the right parsha out, and if it isn't then would have to say it is the next shabbat.
Neither of these is prohibitive to what I am trying to do, I was just wondering if there was an easier way of getting the output from a REST API like you would on the webpage of the date converter which includes the parsha.
Yes, you can use the Jewish calendar REST API to get only parashat haShavuah for an entire year like this:
The s=on means Parashat haShavuah. The other features (major holidays, minor holidays, etc) are all set to "off"
Customer support service by UserEcho
The XML version now includes the parashat haShavua.
https://www.hebcal.com/converter/?cfg=xml&gd=28&gm=12&gy=2015&g2h=1