HTTP POST - FujiNetWIFI/fujinet-firmware GitHub Wiki
Description
When an N: device is opened with the HTTP protocol, with AUX1=13, this causes any data previously written via N: SIO Command 'W' - Write to be sent via HTTP POST. The channel mode will then be set to allow the response to be read via N: SIO Command 'R' - Read.
Parameters
| DCB | Value |
|---|---|
| DDEVIC | $71 |
| DUNIT | $01 - $04 |
| DCOMND | $50 'P' |
| DSTATS | $00 |
| DBUF | NULL |
| DTIMLO | $0F |
| DBYT | 0 |
| DAUX1 | 0 |
| DAUX2 | 1=enable, 0=disable |
Examples
CC65
OS.dcb.ddevic=0x71;
OS.dcb.dunit=1;
OS.dcb.dcomnd='P';
OS.dcb.dstats=0x00;
OS.dcb.dbuf=NULL;
OS.dcb.dtimlo=0x0f;
OS.dcb.dbyt=0;
OS.dcb.daux=0;
siov();
Atari BASIC
To POST from Atari BASIC, the OPEN command is used with AUX1=13. It is highly recommended to use XIO 15 to ensure the payload is flushed to the network correctly.
For a detailed guide on best practices for JSON and reliable POSTing, see Atari BASIC JSON POST Best Practices.
10 OPEN #1,13,2,"N:HTTP://SERVER/API"
20 XIO 77,#1,13,4,"N:":REM POST DATA MODE
30 PRINT #1;"payload";:REM USE ; TO SUPPRESS EOL
40 XIO 15,#1,12,0,"N:":REM FORCE FLUSH
50 XIO 77,#1,13,0,"N:":REM READ RESPONSE MODE
60 INPUT #1,A$:PRINT A$
70 CLOSE #1
- Line 10: Opens the HTTP endpoint with
AUX1=13(POST) andAUX2=2(Unix translation). - Line 20: Switches the channel to POST DATA mode (AUX2=4).
- Line 30: Prints the payload. The semicolon
;is used to prevent an automatic line terminator. - Line 40:
XIO 15forces the write buffer to flush to the network. - Line 50: Switches the channel to READ RESPONSE mode (AUX2=0), triggering the network transaction.
- Line 60: Reads and prints the response body.
See Also
Put other related command links here.