
XBee connection examples
Perform a (GET) HTTP request
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
34
Perform a (GET) HTTP request
You can use the XBee to perform a GET Hypertext Transfer Protocol (HTTP) request using XCTU. HTTP
is an application-layer protocol that runs over TCP. This example uses
as the target
website that responds to the HTTP request.
Note
For help with debugging, see
.
To perform a GET request:
1. Open XCTU and
.
2. Click the
Configuration working mode
button.
3. Select a device from the
Radio Modules
list. XCTU displays the current firmware settings for
that device.
4. To enter the destination address of the target website, in the
DL
field, type
httpbin.org
and
click the
Write
button
.
5. To enter the HTTP request port number, in the
DE
field, type
50
and click the
Write
button.
Hexadecimal
50
is 80 in decimal.
6. To switch to TCP communication, in the
IP
field, select
1
and click the
Write
button.
7. To move into Transparent mode, in the
AP
field, select
0
and click the
Write
button.
8. Wait for the
AI
(Association Indication) value to change to
0
(Connected to the Internet).
9. Click the
Consoles working mode
button
on the toolbar.
10. From the AT console, click the
Add new packet button
in the Send packets dialog. The
Add new packet
dialog appears.
11. Enter the name of the data packet.
12. Type the following data in the
ASCII
input tab:
GET /ip HTTP/1.1
Host: httpbin.org
13. Click the
HEX
input tab and add
0A
(zero A) after each
0D
(zero D), and add an additional
0D 0A
at the end of the message body. For example, copy and past the following text into the
HEX
input tab:
47 45 54 20 2F 69 70 20 48 54 54 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A 20 68 74 74 70 62 69 6E
2E 6F 72 67 0D 0A 0D 0A
Note
The HTTP protocol requires an empty line (a line with nothing preceding the CRLF) to terminate
the request.
14. Click
Add packet
.
15. Click the
Open
button
.
16. Click
Send selected packet
.
17. A GET HTTP response from httpbin.org appears in the Console log.