Skip to main content

http.agenturl()

Returns the agent’s unique URL

Availability

Agent

Returns

String — the agent’s full URL

Description

Each agent is accessed remotely through a unique URL, generated when a specific agent’s device is authorized to access the Electric Imp impCloud™. This method informs the agent of its own URL. For development devices, this is the same URL as that displayed in the Electric Imp IDE at the head of the log pane when a device has been selected. Production devices don‘t appear in the IDE, so this method provides a way for an agent to pass its URL on to a third-party website or a mobile app.

See the documentation for the http object method http.onrequest() to learn how an agent can handle HTTP requests made to this URL.

Example Code