Skip to main content





The HTTPRequest class represents a single HTTP (client) transaction. A new httprequest object is returned from each call to http.get(),, http.put() and similar methods.

This object should not be confused with the request table passed into the HTTP request handler callback that is registered using http.onrequest(). An httprequest object embodies a transaction that will be sent by the agent; the HTTP request handler callback’s request parameter is a table of decoded data from a transaction that has been received.

Each httprequest object is a ‘one shot’: to perform a further request, call http.get(),, http.put() or similar once again to obtain a fresh httprequest object.


The number of requests you can make is rate-limited. Available request credits are shared among httprequest and httpstream. You have credit for a total of 40 requests of any type, ie. if you issue 20 httpstreams you can only issue 20 httprequests until your credits are replenished. As requests are issued they regenerate at the rate of two credits per second, up to the maximum of 40. This allows you to make 120 requests in 60 seconds, issuing up to 40 at any one time.

Rate-limiting is applied per connect.

  • You can find a list of HTTP request response codes with specific meanings for imp-enabled devices here.

Example Code

For sample code that can be used to manage messaging between agents and the Internet, see the imp API Cookbook recipes Basic Agent-to-Internet Communications and Long-polling Agent-to-Internet Communications.

Member Entities

The httprequest object has the following member methods: