EscalatingWeb API

Powered by Artificially Intelligent algorithms, the EscalatingWeb API is capable of converting any website into a Progressive Web App.

Throughout this documentation you will learn about API structure, methods, potential errors and code examples. In case there any question is left unanswered, please make sure to contact us ([email protected], +91 8962488228[whatsapp]) and our team will be happy to help out.

Getting Started

Definitions

Definition Description
Access & Secret Key A unique key assigned to each API account used to authenticate with the API.
Base URL Refers to URL which all API request endpoints and URLs are based on.

Access & Secret Key

Your Access & Secret Key is the unique key that is passed into the API base URL's access_key parameter in order to authenticate with the EscalatingWeb API.

Base URL:

https://www.escalatingweb.com/client/oauth/

Append your Access & Secret Key: Here is how to authenticate with the EscalatingWeb API:

https://www.escalatingweb.com/client/oauth/enable
    ? access_key = ACCESS_KEY & secret_key = SECRET_KEY

API Response

All data is returned in either standard JSON format and can be parsed easily using any programming language or file format for PWA enablement.

Example Response: Below you will find an example API response carrying a number of information for the newly registered domain.

{
    "response": true,
    "message": Created domain successfully,
    "data": {
        "hash": abcdefgh12345678abcdefgh12345678,
        "url": https://www.mysweetnewpwa.com,
        "status": 1,
        "selected_plan": 11,
        "doc": 2018-06-21 00:00:00,
    [...]
    }
}      

Further below, in the Endpoints section, the API response structure will be discussed in detail.

Available Endpoints

The EscalatingWeb API comes with OAuth API endpoints, each providing a different functionality. Please note that depending on your subscription plan, certain API endpoints may or may not be available.

  • Create Domain endpointAdds a new domain or subdomain in real-time to make it ready for the Progressive Web App.
  • Service Worker endpointReturns the service worker for the requested url to power up corresponding Progressive Web App.
  • Manifest endpointReturns the manifest file code for the requested url to power up corresponding Progressive Web App.

SSL Connection

All paid subscription plans available on EscalatingWeb.com come with 256-bit SSL encryption. To connect to the API via SSL, simply use the https protocol instead of standard http.

JSONP Callbacks

The EscalatingWeb API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function.

Example Call:

https://www.escalatingweb.com/client/oauth/domain
    ? access_key = ACCESS_KEY
    & callback = MY_FUNCTION

In the example call above we are requesting the API to use the callback name MY_FUNCTION.

Example Response: Your API response will be wrapped inside your preferred callback function.

({
    "response": true,
    "message": Created domain successfully,
    "data": {
        "hash": abcdefgh12345678abcdefgh12345678,
        "url": https://www.mysweetnewpwa.com,
        "status": 1,
        "selected_plan": 11,
        "doc": 2018-06-21 00:00:00,
    [...]
    }
})  

Access-Control / CORS

EscalatingWeb also supports Cross-Origin Resource Sharing (CORS) and Access-Control Headers. This will enable you to use the EscalatingWeb API via Cross-Origin HTTP Requests.

Learn more about CORS »

HTTP ETags

HTTP ETags are a way of reducing the load on your back-end by requesting new EscalatingWeb data only if Progressive Web App plan is changed since the last API response.

What are ETags?

An ETag is a part of the HTTP protocol and one of the several mechanisms used for cache validation. The ETag is an identifier assigned to a data resource in a server, and if that resource is ever updated at the server, the ETag is changed.

Whenever a resource is requested (via its URL), the data and ETag are retrieved and stored in the Web cache, and the ETag is sent along with subsequent requests. If the ETag at the server has not changed, a "Not Modified" message is returned, and the cached data is used. (Definition by pcmag.com)

ETags - Quickstart Guide

Step 1

Your initial request to the EscalatingWeb API will create an ETag object containing a unique ETag key and a Date object containing the exact date and time at which the data was last modified. This data must be cached along with the entire API response in order for ETags to work.

ETag: "202567a75aef2e66a3ebf2366bff048f"  
Date: Mon, 12 Apr 2018 11:30:01 GMT
Step 2

Once you make another API request, make sure to include the If-None-Match HTTP header abd set ut to your previously generated ETag value. Moreover, you will need to add the If-Modified-Since HTTP header to your API request containing the date and time data from your last request.

If-None-Match: "1872ade88f3013edeb33decd74a4f947"  
If-Modified-Since: Fri, 10 Apr 2015 12:10:04 GMT
Step 3

Depending on whether or not your result set has updated since your last API request, the API will return either:

  • the results from your initial API request along with a 304 – Not Modified HTTP header indicating that no change has occured. In this case, the size of the API response will be as small as 0.2kb;
  • or new results with an entirely new set of ETag and Date objects indicating that new data has been accessed. In this case, the size of your API response will be normal.

Potential Errors

Whenever a requested resource is not available or an API call fails for another reason, a JSON error is returned. Errors always come with an error code and a description.

Example Error: The following error is returned if your API request volume has been exceeded.

{
  "response": false,
  "error": {
    "code": 104,
    "info": "Your API request volume has been reached. Please upgrade your plan."    
  }
}

Other Errors:

Error Code Description
404 The requested resource does not exist.
101 No Access & Secret Key was specified or an invalid Access & Secret Key was specified.
103 The requested API endpoint does not exist.
104 The maximum allowed API amount of API requests has been reached.
105 The current subscription plan does not support this API endpoint.
106 The current request did not return any results.
102 The account this API request is coming from is inactive.
201 An invalid domain has been entered.
403 An invalid access or secret key has been specified.

Create Domain endpoint

Depending on your subscription plan, the API's domain endpoint will add a new url for the corresponding Progressive Web App.

API Request:

POST   https://www.escalatingweb.com/client/oauth/domain

Request Parameters:

Parameter Description
access_key [required] Your Access Key.
secret_key [required] Your Secret Key.
url [required] Your PWA domain name (https://www.mysweetnewpwa.com).
short_name [required] Your PWA Name.
long_name [required] Your PWA Tagline.
img_96 [required] Your PWA logo url of 96x96 size in PNG format.
img_144 [required] Your PWA logo url of 144x144 size in PNG format.
img_192 [required] Your PWA logo url of 192x192 size in PNG format.
img_512 [required] Your PWA logo url of 512x512 size in PNG format.
selected_plan [required] Your PWA plan [1-11].

API Response:

{
    "response": true,
    "message": Created domain successfully,
    "data": {
        "hash": abcdefgh12345678abcdefgh12345678,
        "url": https://www.mysweetnewpwa.com,
        "status": 1,
        "short_name": MyPwa,
        "long_name": My Sweet New PWA,
        "img_96": https://www.mysweetnewpwa.com/assets/img/96.png,
        "img_144": https://www.mysweetnewpwa.com/assets/img/144.png,
        "img_192": https://www.mysweetnewpwa.com/assets/img/192.png,
        "img_512": https://www.mysweetnewpwa.com/assets/img/512.png,
        "selected_plan": 11,
        "doc": 2018-06-21 00:00:00
    }
}      

Response Objects:

Response Object Description
response Returns true or false depending on whether or not your API request has succeeded.
message Returns the message for the returned response.
data Returns the hash for the newly added domain along with the sent data and timestamp of creation.

Service Worker

Depending on your subscription plan, the API's service_worker endpoint returns the service worker code.

Example:

GET  https://www.escalatingweb.com/client/oauth/service_worker
    ? access_key = ACCESS_KEY
    & secret_key = SECRET_KEY

The API's response for the request above must be called with script (preferred) tag or the returned response must be executed with javascript's eval function.

Manifest

Depending on your subscription plan, the API's manifest endpoint returns the service worker code.

Example:

GET  https://www.escalatingweb.com/client/oauth/manifest
    ? access_key = ACCESS_KEY
    & secret_key = SECRET_KEY

The API's response for the request above must be called with <link rel="manifest" > tag.

Sample Code

PHP (cURL)

Real-time domain creation: Find below a simple PHP example for adding a new domain for its corresponding Progressive Web App via the EscalatingWeb API's domain endpoint.

// set API Endpoint and API key 
$endpoint = 'domain';
$data = ''.
'access_key='. ACCESS_KEY.'&'.
'secret_key='. SECRET_KEY.'&'.
'url=  https://www.mysweetnewpwa.com'.'&'.
'short_name=  MyPWA'.'&'.
'long_name=  My Sweet New PWA'.'&'.
'img_96=  https://www.mysweetnewpwa.com/assets/img/96.png'.'&'.
'img_144=  https://www.mysweetnewpwa.com/assets/img/144.png'.'&'.
'img_192=  https://www.mysweetnewpwa.com/assets/img/192.png'.'&'.
'img_512=  https://www.mysweetnewpwa.com/assets/img/512.png'.'&'.
'selected_plan=  11';

// Initialize CURL:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.escalatingweb.com/client/oauth/'.$endpoint);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Store the data:
$json = curl_exec($ch);
curl_close($ch);

Request service worker: Find below a simple PHP example for requesting service worker for its corresponding Progressive Web App via the EscalatingWeb API's service worker endpoint.

// in HTML
<script type="text/javascript" src="https://www.mysweetnewpwa.com/pwa_service_worker" > </script> 

// inside "https://www.mysweetnewpwa.com/pwa_service_worker" endpoint, execute below curl
// set API Endpoint, access key, secret key, required parameters
$endpoint = 'service_worker';
$access_key = ACCESS_KEY;
$secret_key = SECRET_KEY;

$url = 'https://www.mysweetnewpwa.com';
$v = 'randomstring'; // optional

// initialize CURL:
$ch = curl_init('https://www.escalatingweb.com/client/oauth/'.$endpoint.'?access_key='.$access_key.'&secret_key='.$secret_key.'&url='.$url.'&v='.$v.'');   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// print or return this data:
$code = curl_exec($ch);
curl_close($ch);
print($code);

Request manifest: Find below a simple PHP example for requesting manifest for its corresponding Progressive Web App via the EscalatingWeb API's manifest endpoint.

// in HTML
<link rel="manifest" src="https://www.mysweetnewpwa.com/pwa_manifest" > 

// inside "https://www.mysweetnewpwa.com/pwa_manifest" endpoint, execute below curl
// set API Endpoint, access key, secret key, required parameters
$endpoint = 'manifest';
$access_key = ACCESS_KEY;
$secret_key = SECRET_KEY;

$url = 'https://www.mysweetnewpwa.com';
$v = 'randomstring'; // optional

// initialize CURL:
$ch = curl_init('https://www.escalatingweb.com/client/oauth/'.$endpoint.'?access_key='.$access_key.'&secret_key='.$secret_key.'&url='.$url.'&v='.$v.'');   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// print or return this data:
$code = curl_exec($ch);
curl_close($ch);
print($code);