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 httpbin.org/ as the target website that responds to the HTTP request.

Note For help with debugging, see Debugging.

To perform a GET request:

  1. Ensure that the device is set up correctly with the SIM card installed and the antennas connected as described in Connect the hardware.
  2. Open XCTU and Add a device to XCTU.

  3. Click the Configuration working mode button.
  4. Select a device from the Radio Modules list. XCTU displays the current firmware settings for that device.
  5. To enter the destination address of the target website, in the DL field, type httpbin.org and click the Write button .
  6. To enter the HTTP request port number, in the DE field, type 50 and click the Write button. Hexadecimal 50 is 80 in decimal.
  7. To switch to TCP communication, in the IP field, select 1 and click the Write button.
  8. To move into Transparent mode, in the AP field, select 0 and click the Write button.
  9. Wait for the AI (Association Indication) value to change to 0 (Connected to the Internet).
  10. Click the Consoles working mode button on the toolbar.

  11. From the AT console, click the Add new packet button in the Send packets dialog. The Add new packet dialog appears.

  12. Enter the name of the data packet.

  13. Type the following data in the ASCII input tab:

GET /ip HTTP/1.1

Host: httpbin.org

  1. 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.

  1. Click Add packet.
  2. Click the Open button .
  3. Click Send selected packet.
  4. A GET HTTP response from httpbin.org appears in the Console log.