User Tools

Site Tools


packet:bpq-api

BPQ APIs

The one built into BPQ

BPQ has a simple and evolving HTTP REST API. It is used though the HTTPPORT (in this example is port 9122)

endpoints: (note older versions were prefixed with 'get' (except request_token)

/api/request_token
/api/ports
/api/nodes
/api/users
/api/info
/api/links
/api/mheardport/<port#>

Requested like so:

curl 127.0.0.1:9122/api/request_token

Output:

{"access_token":"OSTWFHSGAPKZWMZORFEFWOFIHMOZUMJK", "expires_in":3600, "scope":"create"}

Example of MH for Port 1: ( >ver 6.0.24.33 )

curl 127.0.0.1:9122/api/mheardport?1 -H "Authorization: Bearer OSTWFHSGAPKZWMZORFEFWOFIHMOZUMJK"

Output:

{"callSign": "G7TAJ-15", "port": "1", "packets": 10, "lastHeard": "2024-3-6 17:14:01"  },
{"callSign": "G7TAJ", "port": "1", "packets": 5, "lastHeard": "2024-3-3 15:46:07"  }

Route Roadmap

Detailed info about the routes that exist and those yet to come.

Route Method Description Authentication required? Implemented? Example response
/api/request_token GET Get a token that you will need for authenticated routes no yes `{ “access_token”:“TJFCQDBRVSSHGPWIXFHAJFFKSMZISADL”, “expires_in”:3600, “scope”:“create” }`
/api/ports GET A list of the available ports no yes `{ “ports”: [ {“ID”:“Telnet Server (internal only)”, “Driver”:“TELNET”, “Number”:1,“State”:“Open”}, {“ID”:“AX/IP/UDP”, “Driver”:“BPQAXIP”, “Number”:2,“State”:“Open”}, {“ID”:“2m FM 144.950 MHz 1.2k”, “Driver”:“ASYNC”, “Number”:3,“State”:“Open”} ] }`
/api/nodes GET A list of known nodes no yes `{ “nodes”: [ { “Call”:“G4ZJH-7”, “Alias”:“SAXNOD”, “Routes”: [ {“Call”:“G4ZJH-7”, “Port”:2, “Quality”:192}, {“Call”:“GB7PKT”, “Port”:2, “Quality”:144}, {“Call”:“GB7MSX”, “Port”:2, “Quality”:144}]} ] }`
/api/users GET A list of currently active users no yes `{ “users”: [ {“Call”: “M7GMT”} ] }`
/api/info GET Basic info about the node no yes `{ “info”: { “NodeCall”:“M7GMT-5”, “Alias”:“WYMOND”, “Locator”:“JO02nn”, “Version”:“6.0.24.42” } }`
/api/links GET A list of current links to other nodes no yes `{ “links”: [ {“farCall”:“GB7MSX”, “ourCall”:“M7GMT-5”, “port”:“2”, “state”:“Active”, “linkType”:“Node-Node”, “ax25Version”:“2”} ] }`
/api/mheard/<port#> GET A list of stations that have been recently heard on a specific port no yes
/api/routes GET A list of available routes no no
/api/stats GET Version, uptime stats, etc no no

The one Tom built

Tom is building a docker container that sits next to BPQ and wraps its various interfaces, including the UI, exposing OpenAPI / Swagger endpoints.

Perhaps one day this one will become redundant and can be put out to pasture.

https://github.com/M0LTE/bpqapi

UI scraping notes from Steve G7TAJ

Getting a message list with parameters

M$ID = the token

the options can be null

/Mail/MsgInfo.txt?M$ID --data "<FROM>|<TO>|<VIA>|<BID>|"

response: a list of message numbers delimitered by | (odd end of html at the end)

1234|1235|1236|</body></html>

Get the message header information

/Mail/MsgDetails?M$ID --data "54144"
<html>
    <head>
        <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
        <title>MsgEdit</title>
    </head>
    <body>
        <h4>Message 54144</h4>
        <form style="font-family: monospace;" method=post action=/Mail/Msg?M0000FBE24729 name=Msgs>
            From &nbsp;<input style="font-family: monospace;" size=10 name=From value=CX2SA>
            Sent &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input readonly=readonly size=12 name=Sent value="06-Oct 11:33Z">
            &nbsp;Type &nbsp;&nbsp;&nbsp;&nbsp;
            <select tabindex=1 size=1 name=Type>
                <option selected value=B>B</option>
                <option value=P>P</option>
                <option value=T>T</option>
            </select>
            <br>
            To &nbsp;&nbsp;<input style="font-family: monospace;" size=10 name=To value=NTS>
            Received &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input readonly=readonly size=12 name=RX value="06-Oct 12:05Z">
            &nbsp;Status &nbsp;&nbsp;
            <select tabindex=1 size=1 name=Status>
                <option value=N>N</option>
                <option value=Y>Y</option>
                <option value=F>F</option>
                <option value=K>K</option>
                <option value=H>H</option>
                <option value=D>D</option>
                <option selected value=$>$</option>
            </select>
            <br>
            BID &nbsp;&nbsp;<input style="width:100px; font-family: monospace; " name=BID value="NTS092024">
            Last Changed <input readonly=readonly size=12 name=LastChange value="06-Oct 12:05Z">
            &nbsp;Size &nbsp;<input readonly=readonly size=5 name=Size value=18347>
            <br>
            <br>
            Email From <input style="width:320px;" name=EFROM value=>
            <br>
            &nbsp;VIA &nbsp;<input style="width:360px;" name=VIA value=ARRL>
            <br>
            Title &nbsp;<input style="width:360px;" name=Title value="September 2024 NTS Letter">
            <br>
            <br>
            <span align=center>
                <input onclick=editmsg("EditM?M0000FBE24729?54144" ) value="Edit Text" type=button class='btn'>
                <input onclick=save(this.form) value=Save type=button class='btn'>
                <td>
                    <a href=/Mail/SaveMessage?M0000FBE24729>
                        <button type=button class='btn'>Save Message</button>
                    </a>
                </td>
                <td>
                    <a href=/Mail/SaveAttachment?M0000FBE24729>
                        <button type=button class='btn' disabled>Save Attachment</button>
                    </a>
                </td>
                <input onclick=doit("Print" ) value=Print type=button class='btn'>
                <input onclick=doit("Export" ) value=Export type=button class='btn'>
            </span>
            <br>
            <br>
            Green = Sent, Yellow = Queued
            <table style="text-align: left; width: 490px; font-family: monospace; align=center " border=1 cellpadding=2 cellspacing=2>
                <tr>
                    <td style="background-color: #FFFFFF;" onclick=ck("13" )>G6JME</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("16" )>G7TAJ</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("2" )>G8BPQ</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("14" )>GB7BED</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("8" )>GB7BEX</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("12" )>GB7BPQ</td>
                    <td style="background-color: #FFFFFF;" onclick=ck("52" )>GB7BTN</td>
                    <td style="background-color: #98FFA0;" onclick=ck("37" )>GB7CIP</td>
                </tr>
            </table>
        </form>
    </body>
</html>

Get the message body:

Mail/EditM?M0000FBE24729?54144

response:

<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title></title></head><body><form style="font-family: monospace;  text-align: center;"method=post action=EMSave?M0000FBE24729><textarea cols=90 rows=33 name=Msg>R:241006/1157Z 34168@EI2GYB.DGL.IRL.EURO LinBPQ6.0.24
R:241006/1137Z 18976@PY2BIL.SP.BRA.SOAM LinBPQ6.0.24
R:241006/1137Z 8645@LU9DCE.TOR.BA.ARG.SOAM BPQ6.0.24
R:241006/1136Z 58099@VA3TOK.#SCON.ON.CAN.NOAM LinBPQ6.0.24
R:241006/1136Z 22497@VE3CGR.#SCON.ON.CAN.NOAM LinBPQ6.0.24
R:241006/1135Z 49830@KA1VSC.#CCT.CT.USA.NOAM LinBPQ6.0.24
R:241006/1135Z 8927@WG3K.#SMD.MD.USA.NOAM LinBPQ6.0.24
R:241006/1133Z 17075@N3HYM.#FRDK.MD.USA.NOAM BPQ6.0.24
R:241006/1133Z @:CX2SA.SAL.URY.SOAM #:44327 [Salto] FBB7.00e $:NTS092024

From: CX2SA@CX2SA.SAL.URY.SOAM
To  : NTS@ARRL

                        =========================
                        September 2024 NTS Letter
                        =========================
September 3, 2024

SNIP

</textarea><br><br><input name=Save value=Save type=submit class='btn'><input name=Cancel value=Cancel type=submit class='btn'><br></form></body></html>

The one Twom is building

Twom is patching MQTT support into BPQ itself.

packet/bpq-api.txt · Last modified: 2024/10/08 08:26 by m7gmt