Bonjour,
J’aimerais récupérer les infos des 5 prochains passages de bus à mon arret le plus proche.
J’ai récupéré l’API et un token de la société de transport urbain. Cela me permet de récupérer un JSON avec les infos nécessaires :
{
"ServiceDelivery": {
"ResponseTimestamp": "2023-02-20T13:10:10+01:00",
"RequestMessageRef": null,
"StopMonitoringDelivery": [
{
"version": "2.0",
"ResponseTimestamp": "2023-02-20T13:10:10+01:00",
"ValidUntil": "2023-02-20T13:10:17+01:00",
"ShortestPossibleCycle": "PT30S",
"MonitoringRef": [
"399A"
],
"MonitoredStopVisit": [
{
"RecordedAtTime": "2023-02-20T13:09:45+01:00",
"MonitoringRef": "399A",
"StopCode": "399A",
"MonitoredVehicleJourney": {
"LineRef": "L6",
"DirectionRef": 1,
"FramedVehicleJourneyRef": {
"DatedVehicleJourneySAERef": "17352843-22PVSB-UPC Bus-Semaine-00"
},
"VehicleMode": "bus",
"PublishedLineName": "L6",
"DestinationName": "Pont Phario",
"DestinationShortName": "Pont Phario",
"Via": null,
"MonitoredCall": {
"StopPointName": "Moser",
"ExpectedDepartureTime": "2023-02-20T13:13:30+01:00",
"ExpectedArrivalTime": "2023-02-20T13:13:30+01:00",
"Extension": {
"IsRealTime": true
}
}
}
},
{
"RecordedAtTime": "2023-02-20T13:09:45+01:00",
"MonitoringRef": "399A",
"StopCode": "399A",
"MonitoredVehicleJourney": {
"LineRef": "L6",
"DirectionRef": 1,
"FramedVehicleJourneyRef": {
"DatedVehicleJourneySAERef": "17352816-22PVSB-UPC Bus-Semaine-00"
},
"VehicleMode": "bus",
"PublishedLineName": "L6",
"DestinationName": "Pont Phario",
"DestinationShortName": "Pont Phario",
"Via": null,
"MonitoredCall": {
"StopPointName": "Moser",
"ExpectedDepartureTime": "2023-02-20T13:24:22+01:00",
"ExpectedArrivalTime": "2023-02-20T13:24:22+01:00",
"Extension": {
"IsRealTime": true
}
}
}
},
{
"RecordedAtTime": "2023-02-20T13:09:45+01:00",
"MonitoringRef": "399A",
"StopCode": "399A",
"MonitoredVehicleJourney": {
"LineRef": "L6",
"DirectionRef": 1,
"FramedVehicleJourneyRef": {
"DatedVehicleJourneySAERef": "17352785-22PVSB-UPC Bus-Semaine-00"
},
"VehicleMode": "bus",
"PublishedLineName": "L6",
"DestinationName": "Pont Phario",
"DestinationShortName": "Pont Phario",
"Via": null,
"MonitoredCall": {
"StopPointName": "Moser",
"ExpectedDepartureTime": "2023-02-20T13:34:01+01:00",
"ExpectedArrivalTime": "2023-02-20T13:34:01+01:00",
"Extension": {
"IsRealTime": true
}
}
}
},
{
"RecordedAtTime": "2023-02-20T13:09:45+01:00",
"MonitoringRef": "399A",
"StopCode": "399A",
"MonitoredVehicleJourney": {
"LineRef": "L6",
"DirectionRef": 1,
"FramedVehicleJourneyRef": {
"DatedVehicleJourneySAERef": "17352817-22PVSB-UPC Bus-Semaine-00"
},
"VehicleMode": "bus",
"PublishedLineName": "L6",
"DestinationName": "Pont Phario",
"DestinationShortName": "Pont Phario",
"Via": null,
"MonitoredCall": {
"StopPointName": "Moser",
"ExpectedDepartureTime": "2023-02-20T13:43:59+01:00",
"ExpectedArrivalTime": "2023-02-20T13:43:59+01:00",
"Extension": {
"IsRealTime": true
}
}
}
},
{
"RecordedAtTime": "2023-02-20T13:09:45+01:00",
"MonitoringRef": "399A",
"StopCode": "399A",
"MonitoredVehicleJourney": {
"LineRef": "L6",
"DirectionRef": 1,
"FramedVehicleJourneyRef": {
"DatedVehicleJourneySAERef": "17352844-22PVSB-UPC Bus-Semaine-00"
},
"VehicleMode": "bus",
"PublishedLineName": "L6",
"DestinationName": "Pont Phario",
"DestinationShortName": "Pont Phario",
"Via": null,
"MonitoredCall": {
"StopPointName": "Moser",
"ExpectedDepartureTime": "2023-02-20T13:53:39+01:00",
"ExpectedArrivalTime": "2023-02-20T13:53:39+01:00",
"Extension": {
"IsRealTime": true
}
}
}
}
]
}
]
}
}
Je chercher à récupérer le ExpectedArrivalTime :
ServiceDelivery > StopMonitoringDelivery > 0 > MonitoredStopVisit > 0 > MonitoredVehicleJourney > MonitoredCall > ExpectedArrivalTime
J’utilise le pluggin Script de Jeedom pour ca :
Malheureusement il me retourne constamment un Json invalide ou non décodable.
Vous avez une idée du pourquoi ? Est-ce qu’il y a une autre solution que Script pour récupérer les info d’un JSON ?
Merci
Vincent




