Benutzer-Werkzeuge

Webseiten-Werkzeuge


dapnetapisendrubricl

Dies ist eine alte Version des Dokuments!


Send rubric content via REST-API

Example for curl from linux console

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

Example for python3

import requests

url = 'http://dapnet.db0sda.ampr.org:8080/news'

headers = {'Content-type': 'application/json'}

data = '{ "rubricName": "rubric", "text": "this is the message" }'

data = data.encode('utf-8')

response = requests.post(url, headers=headers, auth=('yourcallsign', 'yourpassword'), data=data)

print(response)

Just an example in Perl from https://github.com/DecentralizedAmateurPagingNetwork/DxClusterInterface/blob/master/dxclusterspider_db0sda

$c = REST::Client->new();
$c->setHost("$dapnethost:$dapnetport");
$c->addHeader('Authorization'=>'Basic ' . encode_base64($dapnetuser . ':' . $dapnetpw));

$c->POST('/news', '{"rubricName": "dx-kwcw", "text": "'.$nachricht.'", "number": '.$pos.'}', {"Content-type"=>'application/json'});
dapnetapisendrubricl.1643545151.txt.gz · Zuletzt geändert: 2022/01/30 13:19 von dj7lc