2.9.1. API

The API functions provide a method of setting and unsettling static talkgroups on the DMR server. Each peer (hotspot) has it’s own API token which is generated by the server and can be seen under each peers details.

The token and the peer needs to be passed with each call. The token can either be submitted in the data as a parameter, or as part of the authentication. In curl this is with the “–user” option. If you use the authentication route then you will need to append : to the token. For example

curl 'https://raynet.m0guy.com/api/list_talkgroups.json' --user '<TOKEN>:' -d 'peer=<DMRID>'

The unique DMRID is the ID of the peer, either 9 or 7 digits long.

The server will return with a json array with the results or OK if the request is correct and completed. If something went wrong or the request is invalid then it will respond with invalid.

2.9.1.1. List Talkgroups

Return an array of number and name for Talkgroups which you are allowed to request as a static on this peer.

curl 'https://raynet.m0guy.com/api/list_talkgroups.json' -d 'peer=<DMRID>&token=<TOKEN>'

Example results

[{"number":"5090600","name":"Z6-Local Net"},{"number":"5090601","name":"Z6-Local Calling 01"},
 {"number":"5090602","name":"Z6-Local Calling 02"},{"number":"5090603","name":"Z6-Local Calling 03"},
 {"number":"5090604","name":"Z6-Local Calling 04"},{"number":"5090605","name":"Z6-Local Calling 05"},
 {"number":"5090606","name":"Z6-Local Calling 06"},{"number":"5090607","name":"Z6-Local Calling 07"},
 {"number":"5090608","name":"Z6-Local Calling 08"},{"number":"5090609","name":"Z6-Local Calling 09"},
 {"number":"5090610","name":"Z6-Local Event 1"},{"number":"5090611","name":"Z6-Local Event 1 - TG1"},
 {"number":"5090612","name":"Z6-Local Event 1 - TG2"},{"number":"5090613","name":"Z6-Local Event 1 - TG3"},
 {"number":"5090614","name":"Z6-Local Event 1 - TG4"},{"number":"5090615","name":"Z6-Local Event 1 - TG5"},
 {"number":"5090616","name":"Z6-Local Event 1 - TG6"},{"number":"5090617","name":"Z6-Local Event 1 - TG7"},
 {"number":"5090618","name":"Z6-Local Event 1 - TG8"},{"number":"5090619","name":"Z6-Local Event 1 - TG9"},
 {"number":"5090620","name":"Z6-Local Event 2"},{"number":"5080400","name":"Berkshire County-Local Net"},
 {"number":"5001200","name":"Berkshire-Local Net"},{"number":"5080600","name":"Bucks-Local Net"}]

2.9.1.2. Get Talkgroups

Return an array of currently set static and dynamic Talkgroups for peer.

  • timeslot - Which timeslot the traffic will be sent

  • enabled - Is this static Talkgroup enabled/disabled. Ie should traffic be sent. Having it disabled does not stop a user sending traffic, the Talkgroup will be set as a dynamic instead.

curl 'https://raynet.m0guy.com/api/get_talkgroups.json' -d 'peer=<DMRID>&token=<TOKEN>'

Examples results

{"static_talkgroups":[{"number":"6075600","name":"Training Team-Local Net","timeslot":"SLOT2","enabled":true},
                      {"number":"6090600","name":"Z6-Local Net","timeslot":"SLOT2","enabled":true},
                      {"number":"6080400","name":"Berkshire County-Local Net","timeslot":"SLOT2","enabled":true},
                      {"number":"6001200","name":"Berkshire-Local Net","timeslot":"SLOT2","enabled":true},
                      {"number":"6019600","name":"Aylesbury-Local Net","timeslot":"SLOT2","enabled":true},
                      {"number":"6089990","name":"NATIONAL-TEST","timeslot":"SLOT2","enabled":true}],
"dynamic_talkgroups":[{"number":"6089999","name":"NATIONAL-Echo TEST","timeslot":"SLOT2"}]}

2.9.1.3. Set Talkgroup

Add or update a static Talkgroup. If the Talkgroup has already been set then setting again will update it’s values, eg changing timeslot or enabled.

Optional paramters

  • timeslot - defaults 2

  • enabled - defaults to active

Note

If the peer is a simplex node then timeslot needs to set to 2. Setting anything else will be ignored and set to 2.

curl 'https://raynet.m0guy.com/api/set_talkgroup.json' -d 'peer=<DMRID>&token=<TOKEN>&tg=<Talkgroup Number>&enabled=<[true|false]>&timeslot=<[1|2]>'

Returns OK if it completed successfully, invalid otherwise.

2.9.1.4. Delete Talkgroup

Remove the Talkgroup from the static and dynamic lists.

curl 'https://raynet.m0guy.com/api/del_talkgroup.json' -d 'peer=<DMRID>&token=<TOKEN>&tg=<TALKGROUP>'