Benutzer-Werkzeuge

Webseiten-Werkzeuge


dapnetapisendrubricl

Send rubric content via REST-API

Example for curl from linux console

curl -H "Content-Type: application/json" -X POST -u yourcallsign:yourpassword -d '{ "rubricName": "rubric", "text": "this is the message" }' http://dapnet.db0sda.ampr.org:8080/news

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)

Example for pearl

$c = REST::Client->new();
$c->setHost("$dapnethost:$dapnetport");
$c->addHeader('Authorization'=>'Basic ' . encode_base64($yourcallsign . ':' . $yourpassword));
$c->POST('/news', '{"rubricName": "rubric", "text": "'.$message.'", "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

{ "rubricName": "rubric", "text": "this is the message", "number": position }
dapnetapisendrubricl.txt · Zuletzt geändert: 2022/01/30 13:27 von dj7lc