Created
February 4, 2020 19:46
-
-
Save kjagiello/f9f436e97addfe70a3846de5e96f8bb4 to your computer and use it in GitHub Desktop.
Retrieves train traffic deviations between Uppsala and Stockholm for yesterday
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
curl \ | |
-X POST \ | |
-H 'Content-Type:application/xml' \ | |
-d @query-announcements.xml \ | |
--silent \ | |
http://api.trafikinfo.trafikverket.se/v1.3/data.json | jq -r '.RESPONSE.RESULT[0].TrainAnnouncement[0].Deviation | .[]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<REQUEST> | |
<LOGIN authenticationkey="716ac6ce0aca41708cefc9b00d62eb1e" /> | |
<QUERY objecttype="TrainAnnouncement"> | |
<DISTINCT>Deviation</DISTINCT> | |
<FILTER> | |
<OR> | |
<EQ name="FromLocation.LocationName" value="U" /> | |
<EQ name="FromLocation.LocationName" value="Cst" /> | |
</OR> | |
<OR> | |
<EQ name="ToLocation.LocationName" value="Cst" /> | |
<EQ name="ToLocation.LocationName" value="U" /> | |
</OR> | |
<GTE name="AdvertisedTimeAtLocation" value="$dateadd(-1.00:00)" /> | |
</FILTER> | |
</QUERY> | |
</REQUEST> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment