| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung |
| dapnetapisendrubricl [2022/01/30 12:19] – dj7lc | dapnetapisendrubricl [2026/01/30 13:08] (aktuell) – Fix urls dj7lc |
|---|
| |
| ===== Example for curl from linux console ===== | ===== Example for curl from linux console ===== |
| | |
| | ===== HAMNET ===== |
| |
| <code> | <code> |
| 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.ampr.org:8080/calls | curl -H "Content-Type: application/json" -X POST -u yourcallsign:yourpassword -d '{ "rubricName": "rubric", "text": "this is the message" }' http://dapnet.db0sda.hamnet.radio:8080/news |
| | </code> |
| | |
| | ===== INTERNET ===== |
| | |
| | <code> |
| | curl -H "Content-Type: application/json" -X POST -u yourcallsign:yourpassword -d '{ "rubricName": "rubric", "text": "this is the message" }' http://hampager.de/api/news |
| </code> | </code> |
| |
| import requests | import requests |
| |
| url = 'http://dapnet.db0sda.ampr.org:8080/news' | # HAMNET |
| | url = 'http://dapnet.db0sda.hamnet.radio:8080/news' |
| | |
| | # INTERNET |
| | #url = 'http://hampager.de/api/news' |
| |
| headers = {'Content-type': 'application/json'} | headers = {'Content-type': 'application/json'} |
| </code> | </code> |
| |
| | ===== Example for pearl ===== |
| Just an example in Perl from https://github.com/DecentralizedAmateurPagingNetwork/DxClusterInterface/blob/master/dxclusterspider_db0sda | |
| |
| <code> | <code> |
| $c = REST::Client->new(); | $c = REST::Client->new(); |
| $c->setHost("$dapnethost:$dapnetport"); | $c->setHost("$dapnethost:$dapnetport"); |
| $c->addHeader('Authorization'=>'Basic ' . encode_base64($dapnetuser . ':' . $dapnetpw)); | $c->addHeader('Authorization'=>'Basic ' . encode_base64($yourcallsign . ':' . $yourpassword)); |
| | $c->POST('/news', '{"rubricName": "rubric", "text": "'.$message.'", "number": '.$pos.'}', {"Content-type"=>'application/json'}); |
| | </code> |
| |
| $c->POST('/news', '{"rubricName": "dx-kwcw", "text": "'.$nachricht.'", "number": '.$pos.'}', {"Content-type"=>'application/json'}); | ===== set a specific position for the skyper rubric content ===== |
| | |
| | Valid positions are integers as char from 1 to 10 |
| | <code> |
| | { "rubricName": "rubric", "text": "this is the message", "number": position } |
| </code> | </code> |