IoT Toolkit – HTTP client
- Memory efficient and easy to use API
- Supports building HTTP requests in simple steps
- Supports any HTTP method like GET, POST, DELETE, ...
- Supports adding custom header fields in the HTTP request
- Can easily be extended for secure connections
About HTTP Client
The HTTP client library is part of the IoT toolkit that allows easy integration and handling of the HTTP protocol in an application without having to deal with the RFC documents it is based on. This allows you to not only request simple webpages but to use powerful IoT REST APIs in the same simple fashion.
Although the HTTP protocol is mostly associated with retrieving web pages from the Internet, the HTTP client is mainly intended to interacting with REST APIs. Retrieving regular web content of course is easily doable as well. The HTTP client implements the Internet Standard [RFC 2616] that is used by popular IoT REST APIs like Dropbox, Xively and many more.
Why SEGGER's HTTP Client?
SEGGER's HTTP client is fully compliant to the standards involved behind the HTTP protocol that you need to keep in mind when talking to modern REST based IoT services.
By providing a simple to use API for constructing your requests and fetching the data without getting in touch with the underlying protocol allows you to stay focused on your actual application with full confidence that everything will simply work.
Sample applications and demos are available to show how simple it can be to work with HTTP based APIs like REST.
SEGGER has developed the HTTP client from scratch to keep stack usage as small as possible and memory requirements to a minimum.
Easy to use API
Using the HTTP client API, constructing a request is done in only a couple of lines of simple code.
IOT_HTTP_AddMethod(&HTTP, "GET"); IOT_HTTP_AddHost(&HTTP, "www.segger.com"); IOT_HTTP_SetPort(&HTTP, 80); IOT_HTTP_AddPath(&HTTP, "/");
The HTTP client requires a TCP/IP stack. It can be used with any RFC-compliant TCP/IP stack. The shipment includes source code samples and Win32 binaries of the samples using the standard Winsock API and can be easily adopted to any standard TCP/IP stack like emNet.
While still many resources on the Internet are available using unsecured connections, more and more services become accessible via secured connection only, making it a standard to support. The HTTP client is not limited to plain unsecured connections. It can be easily extended to support secure connections by using any standard TLS stack like emSSL. This allows the HTTP client to still use unsecured connections for simple tasks like fetching a webpage that does not need security at all while at the same time supporting secure connections for modern IoT APIs.
The SEGGER IoT Toolkit evaluation package
A collection of free Windows executables is available for evaluation purposes to show the functionality of the components of the IoT Toolkit.
You can download the IoT Toolkit evaluation package from the following location: IoT Toolkit evaluation package
HTTP client samples
The following is an excerpt of the samples that can be downloaded with the IoT Toolkit evaluation package in binary form. The shipment also includes the source code to these samples.
Grabbing a non-secure webpage using IOT_HTTP_GetRequest.exe
This executable establishes a plain socket connection to http://www.segger.com and returns the content of the page read. As today's standard is to use a secure connection via HTTPS the page returned is a redirect to the secured version of the website.
Grabbing a secure webpage from a redirect using IOT_HTTP_SecureGet.exe
This executable first establishes a plain socket connection to http://www.segger.com and returns the content of the page read. As today's standard is to use a secure connection via HTTPS the page returned is a redirect to the secured version of the website.
The sample follows the redirect to https://www.segger.com and based on the "https" scheme it established a secure connection to the website to read and return its content.