Benutzer-Werkzeuge

Webseiten-Werkzeuge


dapnetapisendcall

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
dapnetapisendcall [2020/05/17 18:31] – [Example for curl from linux console] pe2kmvdapnetapisendcall [2026/01/30 13:06] (aktuell) – Fix urls dj7lc
Zeile 3: Zeile 3:
 ===== Example for curl from linux console ===== ===== Example for curl from linux console =====
  
-General example:+===== HAMNET ===== 
 <code> <code>
-curl -H "Content-Type: application/json" -X POST -u USER:PASSWORD -d '{ "text": "FUNKRUFTEXT", "callSignNames": ["RUFZEICHEN"], "transmitterGroupNames": ["SENDERGRUPPENNAME"], "emergency": false }' URL/calls+curl -H "Content-Type: application/json" -X POST -u yourcallsign:yourpassword -d '{ "text": "this is the message", "callSignNames": ["destinationcallsign"], "transmitterGroupNames": ["txgroup"], "emergency": false }' http://dapnet.db0sda.hamnet.radio:8080/calls
 </code> </code>
  
 +===== INTERNET =====
  
-Example with real user data (login credentials not working; they have to be replaced by the real ones): 
 <code> <code>
-curl -H "Content-Type: application/json" -X POST -u dl1acb:sehrgeheimespasswort -d '{ "text": "DL1ABC: Das ist eine Sendung über die REST-API", "callSignNames": ["dh1xyz"], "transmitterGroupNames": ["dl-bw"], "emergency": false }' http://http://www.hampager.de:8080/calls+curl -H "Content-Type: application/json" -X POST -u yourcallsign:yourpassword -d '{ "text": "this is the message", "callSignNames": ["destinationcallsign"], "transmitterGroupNames": ["txgroup"], "emergency": false }' http://hampager.de/api/calls
 </code> </code>
  
-===== Example for python ===== + 
-For a python example, have a look on the implementation from Philipp DL7FL: +===== Example for python3 ===== 
-[[https://github.com/DL7FL/DAPNET/blob/master/DAPNET/senden.py|https://github.com/DL7FL/DAPNET/blob/master/DAPNET/senden.py]]+ 
 +<code> 
 +import requests 
 + 
 +# HAMNET 
 +url = 'http://dapnet.db0sda.hamnet.radio:8080/calls' 
 + 
 +# INTERNET 
 +#url = 'http://hampager.de/api/calls' 
 + 
 +headers = {'Content-type': 'application/json'} 
 +  
 +data = '{ "text": "this is the message", "callSignNames": ["destinationcallsign"], "transmitterGroupNames": ["txgroup"], "emergency": false }' 
 + 
 +data = data.encode('utf-8') 
 + 
 +response = requests.post(url, headers=headers, auth=('yourcallsign', 'yourpassword'), data=data) 
 + 
 +print(response) 
 +</code> 
 + 
 +===== make sure to select the correct DAPNET server ===== 
 +When you are connected to HAMNET (either through the air or via VPN) you can use the HAMNET node http://www.hampager.de:8080/calls 
 + 
 +If you're not connected to HAMNET please use the server connected to the public internet http://www.hampager.de:8080/calls
  
 ===== calls to more than one callsign ===== ===== calls to more than one callsign =====
  
-It is also possible to hand over more than one call sign to the API. The call signs then have to be comma separated .+It is also possible to hand over more than one call sign to the API. The call signs then have to be comma separated and quoted. 
 + 
 +<code> 
 +["dl1abc", "dk9xyz", "dj1uvw"] 
 +</code>
  
 But be aware: If one call sign fails (not registered, typo), the whole call is discarded. But be aware: If one call sign fails (not registered, typo), the whole call is discarded.
  
 +===== calls to more than one tx group =====
 +
 +The tx groups have to be comma separated and quoted.
 +
 +<code>
 +["group1", "group2", "group3"]
 +</code>
 +But be aware: If one group is invalid (does not exist, typo), the whole call is discarded.
dapnetapisendcall.1589740285.txt.gz · Zuletzt geändert: 2020/05/17 18:31 von pe2kmv