Thanks to visit codestin.com
Credit goes to scripting.getdrafts.com

Drafts Script Reference
    Preparing search index...

    Class HTTP

    The HTTP and [[HTTPResponse objects are used to run synchronous HTTP requests to communicate with APIs, or just read pages from the web. A full set of custom settings can be passed, and all HTTP methods (GET, POST, PUT, DELETE, etc.) are supported.

    let http = HTTP.create(); // create HTTP object

    let response = http.request({
    "url": "http://myurl.com/api",
    "method": "POST",
    "data": {
    "key":"value"
    },
    "headers": {
    "HeaderName": "HeaderValue"
    }
    });

    if (response.success) {
    var text = response.responseText;
    var data = response.responseData;
    }
    else {
    console.log(response.statusCode);
    console.log(response.error);
    }
    Index

    Options

    followRedirects: boolean

    If true, requests will automatically resolve 301/302 redirect responses. Defaults: true

    Other

    • Create new instance.

      Returns HTTP

    timeout: number

    Time in seconds to wait for a request to receive a response from the server. Default: 60 seconds.

    • Parameters

      • settings: {
            data?: { [x: string]: string };
            encoding?: "json" | "form";
            headers?: { [x: string]: string };
            method: string;
            parameters?: { [x: string]: string };
            password?: string;
            url: string;
            username?: string;
        }

        An object configuring the request.

        • Optionaldata?: { [x: string]: string }

          An object containing data to be encoded into the HTTP body of the request.

        • Optionalencoding?: "json" | "form"

          Format to encode data in the body of request.

        • Optionalheaders?: { [x: string]: string }

          An object contain key-values to be added as custom headers in the request.

        • method: string

          The HTTP method, like "GET", "POST", etc.

        • Optionalparameters?: { [x: string]: string }

          Query parameters to merge with the url. Query parameters can also be part of the original url value.

        • Optionalpassword?: string

          A password to encode for Basic Authentication.

        • url: string

          The absolute HTTP URL for the request.

        • Optionalusername?: string

          A username to encode for Basic Authentication.

      Returns HTTPResponse

    • Instantiate an HTTP object.

      Returns HTTP