What are possible uses for “Send HTTP(S) request” simple action?

What can be done with “Send HTTP(S) request” simple action?

Q: Are there real-life uses for “Send HTTP(S) request” simple action?

A: Yes, there are. Multiple applications and services are providing HTTP-based interfaces (those using HTTP protocol as transport means). Examples of Web applications/services types that can be used with “Send HTTP(S) request” include

  • RESTful Web Services
  • applications supporting XML-RPC
  • certain SOAP-based services

Below we list several examples of such services, and typical use cases.

Sending notifications to instant messengers

Many instant messengers (IMs, such as Skype, ICQ, Viber, WhatsApp etc) provide REST API allowing to send a message to corresponding messenger stream (channel, room, chat etc. – depends on messenger in use). Note: to find whether a messenger supports suitable API, visit its site. Typically, you will see something like “Developer resources” or “API”, containing required information.

An example: open Telegram site and scroll its main page to the bottom. You will see “API” link:

Send HTTP(S) request - Telegram site

When in doubt, you can contact our tech. support to learn, whether IPHost can send alerts to a particular messenger.

Use cases: we already provide instructions on sending alerts to several IMs, namely

Feel free to suggest us to add more IMs to the list.

Send message to notification services

Notification services allow to trigger programmatically a number of event types; anything capable to react to an API call, to an email, SMS etc. can be triggered this way. Examples of notification services: Amazon SNS, Apple Push Notification Service, Google Firebase Cloud Messaging. You could need to establish a REST endpoint yourself before using such services (read more in corresponding service’ description).

Use cases: with Amazon SNS, the following can be achieved by using “Send HTTP(S) request”:

  • Send e-mail: send email message to address(es) subscribed to the corresponding SNS topic; note that you don’t need to explicitly specify which email addresses to use: this can be viewed as mailing list
  • Send push notifications: SNS can be used to make an application on mobile device to receive a notification; thus, monitoring event can appear quickly on mobile device(s) subscribed
  • Run a query against a database: a record can be added to a database, even if it itself has no interface directly accessible by IPHost. For example, a record can be added to database, allowing displaying status of a service on a Web site querying the mentioned database. Other possible uses: informing of weather conditions, of temperature changes in secured areas and so on

Please note that a single SNS topic can trigger all the mentioned above actions (and many others) at the same time.

Manage hosting resources

Certain hosting providers (such as Digital Ocean, CloudSigma, Vultr – to name a few) provide HTTP-based APIs allowing to manage hosting resources (for example, start or stop virtual machines, manage storage, control firewall access). There are also well-known applications suites (such as OpenStack, WHM/CPanel) that are used worldwide by many hosting providers to set up and administer hosting resources – they also can be controlled via HTTP-based API; thus can be managed with “Send HTTP(S) request” simple actions.

Use cases: with the mentioned hosting-related API the following can be achieved by means of “Send HTTP(S) request”:

  • Launch backup service: for example, if a mail (SMTP) server goes down, the alert action can be used to start a backup service that can replace the failed one
  • Suspend virtual site account that used too much of bandwidth: if a monitor reports bandwidth consumption is above certain threshold for a hosted site, that site can be temporarily suspended, allowing its administrator to find and fix the reason for high resources usage
  • Site SSL certificate can be renewed if a monitor detects that the certificate approaches its expiration date, it can request its renewal (using services such as LetsEncrypt)

There can be many other uses, depending on what resources are monitored and what hosting management tool/platform is in use. Note that other simple actions (those sending email or another message) should also be used, to warn the people in charge of a monitoring event and of the automated response(s) to it.

Post to blogs

Most popular blog engines support remote control over content (such as posting new content), using XML-RPC or REST API. Most widely popular blogging platforms (engines) support that: WordPress, Blogger (Google-supported blogging platform), LiveJournal and other services using LJ code base; Movable Type, Tumblr, Typepad etc. Most “microblogs” (such as Twitter, Pump.io powered services, Plurk and so on) can also be used.

This can allow creating generic “service health” posts; please pay close attention what data you include into posts, to avoid disclosing too much information (if the blog you post to is public).

Use cases: alerts (“posts”) can be sent as Twitter direct messages, microblog posts, comments to WordPress posts – and variety of other content type allowed in blogging engines used. It makes little sense posting to public timeline of such services; posting to private (direct) messages, on the other hand, can be an additional notification channel (especially if recipient uses mobile device).

Run maintenance tasks

If a network device doesn’t behave the way it’s expected, perhaps it’s a time to run maintenance tasks on it. Whereas in certain cases a simple restart can do the trick, certain devices may require more complex set of actions. Note: it can be an extremely bad idea to fully automate network device restart with an alert script; running checks (that could, in turn, alert an administrator) is better idea.

The mentioned hosting providers’ API allow to create snapshots, run backup tasks and so on; however, since these actions can also lead to potential service disruption, application-level actions such as running checks and informing administrators are preferable.

Use cases: some examples of what maintenance tasks can be done with “Send HTTP(S) request”:

  • Restart a network device if it supports HTTP(S)-based API; e.g., restarting a WiFi access point, a network router, a VoIP service etc.
  • Create site backup copy: most CMSes (content management systems, e.g. WordPress) support running automated backup/self-checks via HTTP(S)-based API. Running backup creation and/or self-check is a good response to sudden changes in resource availability
  • Run checks on data storage: if a resource fails to respond, a backup service can be inquired on whether there’s a fresh backup for the resource in question; backup services such as BorgBackup, Acronis etc. support API capable of performing such tasks

The general rule of thumb is: action run against a resource in problem state shouldn’t result in possible escalating the alert. Thus, non-destructive actions should be preferred (check integrity; create a backup if that can’t lead to resources outage).

Configure network devices

Nowadays resources available on the Net utilize miscellaneous means to raise their availability. Load balancing, using multihoming and similar techniques provides higher chances to survive hardware or software failure. However, in certain circumstances full automation cannot be achieved, and required action can be triggered from outside.

Use cases include the following typical situarions:

  • Switch to alternate Internet connection can be used to automate response of a gateway address for a multi-home environment going unreachable. When alternate connection can be used, corresponding network device can be reached over a different line and instructed to use it as default gateway. Care should be taken to ensure false alarms, to avoid unnecessary switching.
  • Assigning another IP address to a device can be required if existing public IP becomes unusable. Most modern hosting facilities provide possibility to change the list of IP addresses allocated to a device. For example, loss of keepalive PING requests can trigger allocating another IP address that doesn’t suffer from connectivity problems.

Note that network reconfiguring can also disrupt normal deice functioning, thus should be used with extreme care (and only on non-critical or redundant devices).

Related topics