Cannot find the site "Gärdet" via "SL Platsuppslag"?
Hi gentleman,
I plan to change to API SL Platsuppslag. Most of station name can be found in "SL Platsuppslag". but I find the I cannot find Gärdet. Is there anybody can tell me why?
Many thanks to you.
http://api.sl.se/api2/typeahead.json?key=mykey&searchstring=Gärdet
The response is as follows:
{
StatusCode: 0,
Message: null,
ExecutionTime: 0,
ResponseData: [
{
Name: "Getfotsvägen (Stockholm)",
SiteId: "1875",
Type: "Station",
X: "18077630",
Y: "59261260"
},
{
Name: "Getvägen (Täby)",
SiteId: "2328",
Type: "Station",
X: "18051669",
Y: "59464767"
},
{
Name: "Getstigen (Huddinge)",
SiteId: "7195",
Type: "Station",
X: "18009906",
Y: "59160599"
},
{
Name: "Hötorget (Stockholm)",
SiteId: "9119",
Type: "Station",
X: "18063868",
Y: "59335529"
},
{
Name: "Mälartorget (Stockholm)",
SiteId: "1345",
Type: "Station",
X: "18068192",
Y: "59323016"
},
{
Name: "Mariatorget (t-banan) (Stockholm)",
SiteId: "9297",
Type: "Station",
X: "18062115",
Y: "59317011"
},
{
Name: "Gränsberget (Stockholm)",
SiteId: "1586",
Type: "Station",
X: "18116293",
Y: "59279751"
},
{
Name: "Islandstorget (Stockholm)",
SiteId: "9106",
Type: "Station",
X: "17893351",
Y: "59346415"
},
{
Name: "Höglandstorget (Stockholm)",
SiteId: "9123",
Type: "Station",
X: "17941048",
Y: "59323492"
},
{
Name: "Apoteksbolaget (Huddinge)",
SiteId: "7114",
Type: "Station",
X: "17903806",
Y: "59261368"
}
]
You can see here, "Gärdet" is not in the response list.
Same problem as described here, they've changed encoding from what I can tell, https://kundo.se/org/trafiklabse/d/sl-platsupps...
Cheers!
Thank you Johan. I read your post. But I still don't know how to fix it.
I don't know Swedish, could you please tell me how do you fixed it? Thanks again.
PS:
I have launched my app almost 1 year. It worked very well ant it got 4.4 stars. These days I find there are lot station name cannot be found in API.
If I cannot fix it, my app will receive lots of negative reviews soon. I will be crazy.....
I know your feelings, getting a lot of those emails too.
Basically you need to send unicode to the service.
There's probably better ways of doing this but I first urlencode and then process it to supply it to produce a new string for the service.
So for the `ä`, which you can find here http://unicode-table.com/en/00E4/ I basically replace the urlencoded value with `%E4` to make it work.
Here's the conversion table I'm using. I'm pretty sure this is not expected and will probably be changed at some point again.
("%C3%85", "%C5") # Å
("%C3%84", "%C4") # Ä
("%C3%96", "%D6") # Ö
("%C3%A5", "%E5") # å
("%C3%A4", "%E4") # ä
("%C3%B6", "%F6") # ö
("%C3%A9", "%E9") # é
Cheers!
Hi Johan,
Many many thanks for your patience and your character table. The table works very well.
I just found that even I don't replace Swedish characters, the APIs work well.
Did they notice our discussion and fix the problem?
now the old API and new API both work well.
old API
https://api.trafiklab.se/sl/realtid/GetSite.json?stationSearch=Gärdet&key=MYKEY
and new API:
http://api.sl.se/api2/typeahead.json?key=MYKEY&searchstring=Gärdet&stationsonly=true&maxresults=50
But I don't know if the APIs will go crazy or not.
SL bless us please!
The problem was fixed late last night, finally.
It was an unexpected effect due to a change in the journeyplanner.
Hej SL,
there still seems to be some inconsistency with this API and how it used to work a couple of days ago,
These two queries for Sätra gives two different results, one with capital S and one without.
http://api.sl.se/api2/typeahead.json?key=KEY&se...
http://api.sl.se/api2/typeahead.json?key=KEY&se...
Thanks!
After an "apprecycle" about a week ago the problem seems to be gone.