commit 040f155b3a8c3ad524166a9a964716948322471c Author: erebion Date: Tue Jan 6 18:09:15 2026 +0000 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ef48c9 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# zuginfo_nrw_webpush_ansible + +Simple Ansible Playbooks that demonstrate how zuginfo.nrw's API can be used to send infos concerning railway lines to custom WebPush or UnifiedPush endpoints. + +## How to Use + +Run the Playbooks using Ansible: + +``` +cd zuginfo_playbooks +ansible-playbook zuginfo_api_create_account.yml +``` + +(Do the same for the other playbooks) diff --git a/zuginfo_playbooks/templates/account_or_whatever.json.j2 b/zuginfo_playbooks/templates/account_or_whatever.json.j2 new file mode 100644 index 0000000..5ef3e36 --- /dev/null +++ b/zuginfo_playbooks/templates/account_or_whatever.json.j2 @@ -0,0 +1,27 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrUserDetails", + "req": { + "userId": null + }, + "id": "1|2|" + } + ] +} diff --git a/zuginfo_playbooks/templates/create_webpush_subscription.json.j2 b/zuginfo_playbooks/templates/create_webpush_subscription.json.j2 new file mode 100644 index 0000000..625949d --- /dev/null +++ b/zuginfo_playbooks/templates/create_webpush_subscription.json.j2 @@ -0,0 +1,34 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrUserCreate", + "req": { + "language": "de", + "availableChannels": [ + { + "channelId": "", + "type": "WEBPUSH", + "address": "{\"endpoint\":\"{{ push_endpoint }}\",\"keys\":{\"auth\":\"{{ push_key_auth }}\",\"p256dh\":\"{{ push_key_p256dh }}\"}}" + } + ] + }, + "id": "1|3|" + } + ] +} diff --git a/zuginfo_playbooks/templates/delete_account.json.j2 b/zuginfo_playbooks/templates/delete_account.json.j2 new file mode 100644 index 0000000..0573bc2 --- /dev/null +++ b/zuginfo_playbooks/templates/delete_account.json.j2 @@ -0,0 +1,27 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrUserDelete", + "req": { + "userId": "{{ user_id }}" + }, + "id": "1|5|" + } + ] +} diff --git a/zuginfo_playbooks/templates/delete_subscription.json.j2 b/zuginfo_playbooks/templates/delete_subscription.json.j2 new file mode 100644 index 0000000..eac6563 --- /dev/null +++ b/zuginfo_playbooks/templates/delete_subscription.json.j2 @@ -0,0 +1,28 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrDelete", + "req": { + "subscrId": {{ subscription_id }}, + "userId": "{{ user_id }}" + }, + "id": "1|13|" + } + ] +} diff --git a/zuginfo_playbooks/templates/detail_subscriptions.json.j2 b/zuginfo_playbooks/templates/detail_subscriptions.json.j2 new file mode 100644 index 0000000..efa58f1 --- /dev/null +++ b/zuginfo_playbooks/templates/detail_subscriptions.json.j2 @@ -0,0 +1,28 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrDetails", + "req": { + "subscrId": {{ subscription_id }}, + "userId": "{{ user_id }}" + }, + "id": "1|10|" + } + ] +} diff --git a/zuginfo_playbooks/templates/get_channel_id.json.j2 b/zuginfo_playbooks/templates/get_channel_id.json.j2 new file mode 100644 index 0000000..ed99bf6 --- /dev/null +++ b/zuginfo_playbooks/templates/get_channel_id.json.j2 @@ -0,0 +1,27 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrUserDetails", + "req": { + "userId": "{{ user_id }}" + }, + "id": "1|4|" + } + ] +} diff --git a/zuginfo_playbooks/templates/list_subscriptions.json.j2 b/zuginfo_playbooks/templates/list_subscriptions.json.j2 new file mode 100644 index 0000000..a5ffca5 --- /dev/null +++ b/zuginfo_playbooks/templates/list_subscriptions.json.j2 @@ -0,0 +1,27 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrSearch", + "req": { + "userId": "{{ user_id }}" + }, + "id": "1|9|" + } + ] +} diff --git a/zuginfo_playbooks/templates/mysterious_id.json.j2 b/zuginfo_playbooks/templates/mysterious_id.json.j2 new file mode 100644 index 0000000..10f1f3b --- /dev/null +++ b/zuginfo_playbooks/templates/mysterious_id.json.j2 @@ -0,0 +1,30 @@ +{ + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "req": { + "getMapLayerConfig": true, + "getConGroups": false, + "getServerDateTime": true, + "getTimeTablePeriod": true, + "getEuSpiritRegions": true + }, + "meth": "ServerInfo", + "id": "1|0|" + } + ] +} diff --git a/zuginfo_playbooks/templates/subscription_s4.json.j2 b/zuginfo_playbooks/templates/subscription_s4.json.j2 new file mode 100644 index 0000000..3afa639 --- /dev/null +++ b/zuginfo_playbooks/templates/subscription_s4.json.j2 @@ -0,0 +1,77 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrCreate", + "req": { + "statSubscr": { + "hysteresis": { + "himFltrL": [ + { + "type": "HIMCAT", + "mode": "INC", + "value": "0" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "4" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "2" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "3" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "1" + } + ] + }, + "jnyFltrL": [ + { + "type": "LINEID", + "mode": "INC", + "value": 92404 + } + ], + "serviceDays": { + "selectedWeekdays": "1111111", + "beginDate": "20250615", + "endDate": "20331211", + "beginTime": "000000", + "endTime": "235959" + } + }, + "userId": "{{ user_id }}", + "channels": [ + { + "channelId": "{{ channel_id }}" + } + ] + }, + "id": "1|5|" + } + ] +} diff --git a/zuginfo_playbooks/templates/update_subscription.json.j2 b/zuginfo_playbooks/templates/update_subscription.json.j2 new file mode 100644 index 0000000..440cf69 --- /dev/null +++ b/zuginfo_playbooks/templates/update_subscription.json.j2 @@ -0,0 +1,78 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrUpdate", + "req": { + "userId": "{{ user_id }}", + "subscrId": {{ subscription_id }}, + "statSubscr": { + "hysteresis": { + "himFltrL": [ + { + "type": "HIMCAT", + "mode": "INC", + "value": "0" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "4" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "2" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "3" + }, + { + "type": "HIMCAT", + "mode": "INC", + "value": "1" + } + ] + }, + "jnyFltrL": [ + { + "type": "LINEID", + "mode": "INC", + "value": 92404 + } + ], + "serviceDays": { + "selectedWeekdays": "1111110", + "beginDate": "20250615", + "endDate": "20331211", + "beginTime": "00000000", + "endTime": "00235959" + } + }, + "channels": [ + { + "channelId": "{{ channel_id }}" + } + ] + }, + "id": "1|12|" + } + ] +} diff --git a/zuginfo_playbooks/templates/verify_subscription.json.j2 b/zuginfo_playbooks/templates/verify_subscription.json.j2 new file mode 100644 index 0000000..6b1cb15 --- /dev/null +++ b/zuginfo_playbooks/templates/verify_subscription.json.j2 @@ -0,0 +1,28 @@ +{ + "id": "{{ mysterious_id }}", + "ver": "1.24", + "lang": "deu", + "auth": { + "type": "AID", + "aid": "{{ aid }}" + }, + "client": { + "id": "HAFAS", + "type": "WEB", + "name": "webapp", + "l": "vs_webapp", + "v": 10104 + }, + "formatted": false, + "ext": "VRR.1", + "svcReqL": [ + { + "meth": "SubscrDetails", + "req": { + "subscrId": {{ subscription_id }}, + "userId": "{{ user_id }}" + }, + "id": "1|6|" + } + ] +} diff --git a/zuginfo_playbooks/zuginfo_api_create_account.yml b/zuginfo_playbooks/zuginfo_api_create_account.yml new file mode 100644 index 0000000..d666a0e --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_create_account.yml @@ -0,0 +1,61 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + #aid: "" + #mysterious_id: "" + + tasks: + - name: "Get AID (Token)" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/config/webapp.config.json?v={{ unix_time_millis }}" + method: GET + register: token + when: aid is undefined + + - name: "Print AID (Token)" + ansible.builtin.debug: + msg: "{{ token }}" + + - set_fact: + aid: "{{ token.json.hciAuth.aid }}" + when: aid is undefined + + - name: "Get Mysterious ID" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId=undefined&hciMethod=ServerInfo&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','mysterious_id.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: get_mysterious_id + when: mysterious_id is undefined + + - name: "Print Mysterious ID" + ansible.builtin.debug: + msg: "{{ get_mysterious_id }}" + + - set_fact: + mysterious_id: "{{ get_mysterious_id.json.id }}" + when: mysterious_id is undefined + + - name: "Unknown Request" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','account_or_whatever.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: account_whatever + + - name: "Print Result of Unknown Request" + ansible.builtin.debug: + msg: "{{ account_whatever }}" diff --git a/zuginfo_playbooks/zuginfo_api_create_webpush_subscription.yml b/zuginfo_playbooks/zuginfo_api_create_webpush_subscription.yml new file mode 100644 index 0000000..b61fe95 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_create_webpush_subscription.yml @@ -0,0 +1,87 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + push_endpoint: "" + push_key_auth: "" + push_key_p256dh: "" + aid: "" + mysterious_id: "" + + tasks: + - name: "Create WebPush Subscription" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','create_webpush_subscription.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: webpush_subscription + + - name: "Create WebPush Subscription" + ansible.builtin.debug: + msg: "{{ webpush_subscription }}" + + - set_fact: + user_id: "{{ webpush_subscription.json.svcResL[0].res.userId }}" + + - name: "Get a Channel ID" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','get_channel_id.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: channel_id + + - name: "channel_id" + ansible.builtin.debug: + msg: "{{ channel_id }}" + + - set_fact: + channel_id: "{{ channel_id.json.svcResL[0].res.availableChannels[0].channelId }}" + + - name: "Subscribe to info for S4" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','subscription_s4.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: subscribe_s4 + + - name: "subscribe_s4" + ansible.builtin.debug: + msg: "{{ subscribe_s4 }}" + + - set_fact: + subscription_id: "{{ subscribe_s4.json.svcResL[0].res.subscrId }}" + + - name: "Verify Subscription" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','verify_subscription.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: verify_subscription + + - name: "Result: Verify Subscription" + ansible.builtin.debug: + msg: "{{ verify_subscription }}" diff --git a/zuginfo_playbooks/zuginfo_api_delete_account.yml b/zuginfo_playbooks/zuginfo_api_delete_account.yml new file mode 100644 index 0000000..17aa5a5 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_delete_account.yml @@ -0,0 +1,27 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + aid: "" + mysterious_id: "" + user_id: "" + + tasks: + - name: "Delete Account" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDelete&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','delete_account.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: delete_account + + - name: "Print Result of Account Deletion" + ansible.builtin.debug: + msg: "{{ delete_account }}" diff --git a/zuginfo_playbooks/zuginfo_api_delete_subscription.yml b/zuginfo_playbooks/zuginfo_api_delete_subscription.yml new file mode 100644 index 0000000..3f81506 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_delete_subscription.yml @@ -0,0 +1,28 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + aid: "" + mysterious_id: "" + subsciption_id: "" + user_id: "" + + tasks: + - name: "Delete Subscription" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrDelete&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','delete_subscription.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: delete_subscription + + - name: "Print Result of Deleting Subscription" + ansible.builtin.debug: + msg: "{{ delete_subscription }}" diff --git a/zuginfo_playbooks/zuginfo_api_list_subscriptions.yml b/zuginfo_playbooks/zuginfo_api_list_subscriptions.yml new file mode 100644 index 0000000..4ebd1b8 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_list_subscriptions.yml @@ -0,0 +1,42 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + aid: "" + mysterious_id: "" + + tasks: + - name: "List Subscriptions" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrSearch&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','list_subscriptions.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: list_subscription + + - name: "Print Result: List of Subscriptions" + ansible.builtin.debug: + msg: "{{ list_subscription }}" + + - name: "Detail Subscriptions" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUserDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','detail_subscriptions.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: detail_subscription + + - name: "Print Result: Details of Subscriptions" + ansible.builtin.debug: + msg: "{{ detail_subscription }}" diff --git a/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml b/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml new file mode 100644 index 0000000..dff6dd0 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml @@ -0,0 +1,46 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + aid: "" + mysterious_id: "" + + tasks: + - name: "Subscribe to info for S4" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','subscription_s4.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: subscribe_s4 + + - name: "Print Result: Subscribe to S4" + ansible.builtin.debug: + msg: "{{ subscribe_s4 }}" + + - set_fact: + subscription_id: "{{ subscribe_s4.json.svcResL[0].res.subscrId }}" + + - name: "Verify Subscription" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','verify_subscription.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + TE: trailers + register: verify_subscription + + - name: "Print Result: Verify Subscription" + ansible.builtin.debug: + msg: "{{ verify_subscription }}" diff --git a/zuginfo_playbooks/zuginfo_api_update_subscription.yml b/zuginfo_playbooks/zuginfo_api_update_subscription.yml new file mode 100644 index 0000000..47b0868 --- /dev/null +++ b/zuginfo_playbooks/zuginfo_api_update_subscription.yml @@ -0,0 +1,25 @@ +--- + +- name: "Zuginfo.nrw API" + hosts: localhost + vars: + unix_time_millis: "1762342729099" + aid: "" + mysterious_id: "" + + tasks: + - name: "Update Subscription (no messages on S4 concerning Sundays)" + ansible.builtin.uri: + url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUpdate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" + method: POST + body: "{{ lookup('ansible.builtin.template','update_subscription.json.j2') }}" + headers: + Accept-Encoding: gzip, deflate, br, zstd + Content-Type: application/json + Origin: https://www.zuginfo.nrw/ + Referer: https://www.zuginfo.nrw/ + register: update_subscription + + - name: "Print Result of Updating Subscription" + ansible.builtin.debug: + msg: "{{ update_subscription }}"