0
Not a bug

Shabbat times REST API bug?

Joseph Dov Kohan 1 month ago • updated by Michael J. Radwin 1 month ago 3

Hi, I'm using the Shabbat times REST API and found that when I send values for b (Candle-lighting time minutes before sunset) it change the construccion of the JSON but keeps the same candle lighting value, I tried with different numbers (mostrly 18 and 40), please advise... thanks!

Answer

Answer
Not a bug

Thanks for using Hebcal!


We don't guarantee order of the items in JSON or RSS. You really should use a proper library to parse web services APIs and not just string regex.

We have tested the b= parameter and it functions as described in the documentation. We are unable to reproduce the issue you mentioned in your first post.


The candle lighting item of the JSON looks like this ones:

{
"title": "Candle lighting: 5:31pm",
"hebrew": "הדלקת נרות",
"date": "2018-10-12T17:31:00+03:00",
"category": "candles"
},

But then looks like this:

{
"title": "Candle lighting: 5:31pm",
"category": "candles",
"date": "2018-10-12T17:31:00+03:00",
"hebrew": "הדלקת נרות"
},

1) I cannot parse the data when the order changes everytime, and

2) I'm getting the same candle lighting time when I send b=18 than when I do b=40... !?!

OK, found that JSON by definition don't keep the order and thats good when the parsing is made by logical JSON but the system I'm using sees all the JSON as a big string where I can search using regex.

Do the RSS response keeps the same structure always?

Answer
Not a bug

Thanks for using Hebcal!


We don't guarantee order of the items in JSON or RSS. You really should use a proper library to parse web services APIs and not just string regex.

We have tested the b= parameter and it functions as described in the documentation. We are unable to reproduce the issue you mentioned in your first post.