{
	"info": {
		"_postman_id": "3bfa458b-effb-4c9e-bffc-2235b3938c9b",
		"name": "Data Hub API",
		"description": "How-To Beispiele als Postman Collection.\n\nVerwendung:\n\nPostman Environment anlegen und folgende Einträge hinterlegen:\n\n - clientID\n - tenantID\n - clientSecret\n - resource\n - hostname\n\n\nSiehe auch https://github.com/Rhein-Neckar-Verkehr/Data-Hub-API-How-To#voraussetzungen \n\nDie Authentifizierung muss je nach Gültigkeit des Bearer-Tokens ausgeführt werden. Der Token wird dann in einer Globalen Variable in Postman gespeichert. Dann können die restlichen Beispiele ausgeführt werden.\n\nAusführliche Erläuterungen und Beispiele zur Pagination finden Sie im Hauptdokument https://github.com/Rhein-Neckar-Verkehr/Data-Hub-API-How-To.\n",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Authorization",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "3a9c790d-e3ef-445e-9d99-5dc62066d07b",
						"exec": [
							"pm.globals.set(\"bearerToken\", pm.response.json().access_token);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/x-www-form-urlencoded",
						"type": "text"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "grant_type",
							"value": "client_credentials",
							"type": "text"
						},
						{
							"key": "client_id",
							"value": "xxx",
							"type": "text"
						},
						{
							"key": "client_secret",
							"value": "xxx",
							"type": "text"
						},
						{
							"key": "resource",
							"value": "xxx",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "https://login.microsoftonline.com/{{tenantID}}/oauth2/token",
					"protocol": "https",
					"host": [
						"login",
						"microsoftonline",
						"com"
					],
					"path": [
						"{{tenantID}}",
						"oauth2",
						"token"
					]
				}
			},
			"response": []
		},
		{
			"name": "Suche nach Haltestellen",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"id": "87ad2c27-a643-4846-9e14-0e98713e51be",
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"type": "text",
						"value": "Bearer {{bearerToken}}"
					}
				],
				"body": {
					"mode": "graphql",
					"graphql": {
						"query": "{\n  stations(first: 3 lat:49.483076 long:8.468409 distance:0.5) {\n    totalCount\n    elements {\n      ... on Station {\n        hafasID\n        globalID\n        longName\n      }\n    }\n  }\n}",
						"variables": ""
					}
				},
				"url": {
					"raw": "{{hostname}}/",
					"host": [
						"{{hostname}}"
					],
					"path": [
						""
					]
				},
				"description": "Beispiel für eine Abfahrtsmonitorabfrage"
			},
			"response": []
		},
		{
			"name": "Abfrage einer Haltestelle",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"id": "87ad2c27-a643-4846-9e14-0e98713e51be",
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"type": "text",
						"value": "Bearer {{bearerToken}}"
					}
				],
				"body": {
					"mode": "graphql",
					"graphql": {
						"query": "{\n  station(id:\"2471\") {\n    hafasID\n    longName\n    shortName\n    name\n  }\n}",
						"variables": ""
					}
				},
				"url": {
					"raw": "{{hostname}}/",
					"host": [
						"{{hostname}}"
					],
					"path": [
						""
					]
				},
				"description": "Beispiel für eine Abfahrtsmonitorabfrage"
			},
			"response": []
		},
		{
			"name": "Erstellung eines Abfahrtsmonitors",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"id": "87ad2c27-a643-4846-9e14-0e98713e51be",
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{bearerToken}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "graphql",
					"graphql": {
						"query": "{\n  station(id:\"2417\") {\n    hafasID\n    longName\n    journeys(startTime: \"2020-03-26T11:17:00Z\" first: 5) {\n      totalCount\n      elements {\n        ... on Journey {\n          \n          line {\n            id\n          }\n          \n          stops {\n            \n            plannedDeparture {\n              isoString\n            }\n            \n            realtimeDeparture {\n              isoString\n            }\n          }\n        }\n      }\n    }\n  }\n}",
						"variables": ""
					}
				},
				"url": {
					"raw": "{{hostname}}/",
					"host": [
						"{{hostname}}"
					],
					"path": [
						""
					]
				},
				"description": "Beispiel für eine Abfahrtsmonitorabfrage"
			},
			"response": []
		},
		{
			"name": "Verbindungsauskunft",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"id": "87ad2c27-a643-4846-9e14-0e98713e51be",
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"type": "text",
						"value": "Bearer {{bearerToken}}"
					}
				],
				"body": {
					"mode": "graphql",
					"graphql": {
						"query": "{\n  trips(originGlobalID:\"de:08222:2471\" destinationGlobalID:\"de:08222:2417\" departureTime:\"2020-03-26T15:15:00Z\") {\n    startTime {\n      isoString\n    }\n    \n    endTime {\n      isoString\n    }\n    \n    interchanges\n    \n    legs {\n      \n      ... on InterchangeLeg {\n        mode\n        \n      }\n      \n      ... on TimedLeg {\n        board {\n          point {\n            ... on StopPoint {\n              ref\n            \tlocationName\n            }\n          }\n          estimatedTime {\n            isoString\n          }\n          timetabledTime {\n            isoString\n          }\n        }\n        \n        alight {\n          point {\n            ... on StopPoint {\n              ref\n            \tlocationName\n            }\n          }\n          \n          estimatedTime {\n            isoString\n          }\n          timetabledTime {\n            isoString\n          }\n          \n          \n        }\n        \n        service {\n          type\n          name\n          description\n          destinationLabel\n        }\n        \n        \n      }\n      \n      ... on ContinuousLeg {\n        mode\n      }\n    }\n  }\n\n}",
						"variables": ""
					}
				},
				"url": {
					"raw": "{{hostname}}/",
					"host": [
						"{{hostname}}"
					],
					"path": [
						""
					]
				},
				"description": "Beispiel für eine Abfahrtsmonitorabfrage"
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"id": "5a8ab6c9-097a-4265-bfcb-28a6ff34a967",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"id": "22d21ed5-2bb1-4ed6-9966-b68bbf7ef633",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"protocolProfileBehavior": {}
}