Networking

A guide to work with network requests and responses. Using rest api with Flipabit.

The XMLHttpRequest object allows the user to register a response handle function and a url. A request can be send using one of the http verbs (get, post, put, delete, ...) to make the request. When the response arrive the handle function is called. The handle function is called several times. Every-time the request state has changed (for example headers have arrived or request is done).

Here a short example:

function request() {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
            print('HEADERS_RECEIVED');
        } else if(xhr.readyState === XMLHttpRequest.DONE) {
            print('DONE');
        }
    }
    xhr.open("GET", "http://example.com");
    xhr.send();
}

Read more:

Examples

Zapier

Using Zapier arrow-up-rightWebhooks. Download the zapier.pmaarrow-up-right example.

1. Create new ZAP https://zapier.com/apps/email/integrations/webhook/62/turn-webhooks-into-sent-emailsarrow-up-right

2. Add following fields

3. Edit Template

4. Turn on your ZAP

5.Paste Webhook URL into code

The code:

Mailgun

Send email with mailgunarrow-up-right. Download the mailgun.pmaarrow-up-right example.

1. Open domain info in mailgun dashboard

2. Use the following code to send email. Replace it with your Domain and API Key:

Last updated