Required Endpoints
To successfully develop a plugin for WebCommander, it’s essential to understand the required endpoints for communication with the platform. These endpoints facilitate the installation and uninstallation of your plugin. Here, we outline the necessary endpoints and provide examples in various programming languages for your reference.
Install Endpoint
When a client initiates the installation process for your WebCommander plugin, the platform will first look for your /install
endpoint. You must develop this endpoint to handle specific payloads provided by WebCommander. Based on the response from your /install
endpoint, WebCommander will determine which modules your plugin needs access to and complete the installation process within the client’s site.
Example Implementations
curl --location --request GET 'https://yourapp.com/install?uuid=F8A3-A88E-C6EF-B1CB' \
--form 'token="517e58080ddddf80d2f23b1783a2a457"' \
--form 'accessToken="11b4ec017714ef095b8e115545467fcb"' \
--form 'clientSecret="6b73c5a273cf49300dbec9b8abf83a06"' \
--form 'clientId="48eaecb5dc079f039cb09b50ab9cae54"' \
--form 'refreshToken="1db5045139d1e701b72f8046d2d17135"' \
--form 'encryptionKey="CIaGf7Ely0ykfBOi94hEPUAacyaHmjB4oZHc0JMVLMM="' \
--form 'apiUrl="http://5289d153.wc-stage.webcommander.com/"' \
--form 'adminPanel="https://stage-my.webcommander.com/"'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://yourapp.com/install?uuid=F8A3-A88E-C6EF-B1CB',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array(,,,,,,,),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import mimetypes
from codecs import encode
conn = http.client.HTTPSConnection("yourapp.com")
dataList = []
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=token;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("517e58080ddddf80d2f23b1783a2a457"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=accessToken;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("11b4ec017714ef095b8e115545467fcb"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=clientSecret;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("6b73c5a273cf49300dbec9b8abf83a06"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=clientId;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("48eaecb5dc079f039cb09b50ab9cae54"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=refreshToken;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("1db5045139d1e701b72f8046d2d17135"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=encryptionKey;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("CIaGf7Ely0ykfBOi94hEPUAacyaHmjB4oZHc0JMVLMM="))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=apiUrl;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("http://5289d153.wc-stage.webcommander.com/"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=adminPanel;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("https://stage-my.webcommander.com/"))
dataList.append(encode('--'+boundary+'--'))
dataList.append(encode(''))
body = b'\r\n'.join(dataList)
payload = body
headers = {
'Content-type': 'multipart/form-data; boundary={}'.format(boundary)
}
conn.request("GET", "/install?uuid=F8A3-A88E-C6EF-B1CB", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://yourapp.com/install?uuid=F8A3-A88E-C6EF-B1CB")
.multiPartContent()
.field("token", "517e58080ddddf80d2f23b1783a2a457")
.field("accessToken", "11b4ec017714ef095b8e115545467fcb")
.field("clientSecret", "6b73c5a273cf49300dbec9b8abf83a06")
.field("clientId", "48eaecb5dc079f039cb09b50ab9cae54")
.field("refreshToken", "1db5045139d1e701b72f8046d2d17135")
.field("encryptionKey", "CIaGf7Ely0ykfBOi94hEPUAacyaHmjB4oZHc0JMVLMM=")
.field("apiUrl", "http://5289d153.wc-stage.webcommander.com/")
.field("adminPanel", "https://stage-my.webcommander.com/")
.asString();
var options = new RestClientOptions("")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("https://yourapp.com/install?uuid=F8A3-A88E-C6EF-B1CB", Method.Get);
request.AlwaysMultipartFormData = true;
request.AddParameter("token", "517e58080ddddf80d2f23b1783a2a457");
request.AddParameter("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddParameter("clientSecret", "6b73c5a273cf49300dbec9b8abf83a06");
request.AddParameter("clientId", "48eaecb5dc079f039cb09b50ab9cae54");
request.AddParameter("refreshToken", "1db5045139d1e701b72f8046d2d17135");
request.AddParameter("encryptionKey", "CIaGf7Ely0ykfBOi94hEPUAacyaHmjB4oZHc0JMVLMM=");
request.AddParameter("apiUrl", "http://5289d153.wc-stage.webcommander.com/");
request.AddParameter("adminPanel", "https://stage-my.webcommander.com/");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
Request Details
Request URL: https://yourapp.com/install?uuid=F8A3-A88E-C6EF-B1CB
Request Method: GET
Request Parameter
Name |
Type |
Required |
Description |
---|---|---|---|
token |
String |
Yes |
Token is used as a verifier to communicate with WebCommander APIs. |
adminPanel |
String |
Yes |
WebCommander dashboard URL of the site where the plugin is requested to install. |
accessToken |
String |
Yes |
Access token is used as a verifier to communicate with WebCommander APIs. |
clientId |
String |
Yes |
A unique identifier for users. |
clientSecret |
String |
Yes |
Client secret protects system resources by granting tokens. |
refreshToken |
String |
Yes |
A unique key for a client to request new access token. |
encryptionKey |
String |
No |
A validation algorithm to encode a secret key. |
scope |
String |
No |
Permissions granted for authentication. |
Response
{
"webhooks": [
{
"sourceUrl": "https://example.com/api/v1/webhooks/get",
"eventName": "DummyEvent1",
"renderScope": "",
"accessType": "webhook"
},
{
"sourceUrl": "https://example.com/api/v1/webhooks/submit",
"eventName": "DummyEvent2",
"renderScope": "",
"accessType": "webhook"
}
],
"scriptTags": [
{
"sourceUrl": "https://yourapp.com/assets/js/script-tag.js",
"eventName": "DummyName",
"renderScope": "All",
"accessType": "scriptTag"
}
],
"widgets": [
{
"widgetName": "WidgetABC",
"widgetLabel": "DummyWidget",
"widgetTitle": "DummyWidget",
"widgetLogo": "https://example.com/assets/images/widget-icon.svg",
"sourceUrl": "https://example.com/DummyWidget/Index",
"configurationUrl": "https://example.com/DummyWidgetSettings/Index"
}
],
"customerProfileTabs": [
{
"customerProfileTabIdentifier": "ProfileTab1",
"customerProfileTabDisplayName": "Tab1",
"customerProfileTabSourceUrl": "https://example.com/Tab1"
},
{
"customerProfileTabIdentifier": "ProfileTab2",
"customerProfileTabDisplayName": "Tab2",
"customerProfileTabSourceUrl": "https://example.com/Tab2"
},
{
"customerProfileTabIdentifier": "ProfileTab3",
"customerProfileTabDisplayName": "Tab3",
"customerProfileTabSourceUrl": "https://example.com/Tab3"
}
],
"apiAccessScopes": [
"customer_create"
]
}
Uninstall Endpoint
When a client initiates the uninstallation process for your WebCommander plugin, WebCommander will call your /uninstall
endpoint. This endpoint must be developed to handle specific payloads provided by WebCommander. The payload contains data related to the client’s site, which your plugin will use to perform necessary cleanup operations.
Example Implementations
curl --location 'https://yourapp.com/uninstall?uuid=F8A3-A88E-C6EF-B1CB'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://yourapp.com/uninstall?uuid=F8A3-A88E-C6EF-B1CB',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {}
conn.request("GET", "/uninstall?uuid=F8A3-A88E-C6EF-B1CB", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://yourapp.com/uninstall?uuid=F8A3-A88E-C6EF-B1CB")
.asString();
var options = new RestClientOptions("")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("https://yourapp.com/uninstall?uuid=F8A3-A88E-C6EF-B1CB", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
Request Details
Request URL: https://yourapp.com/uninstall?uuid=F8A3-A88E-C6EF-B1CB
Request Method: GET
Request Parameter
Name | Type | Required | Description |
---|---|---|---|
uuid | String | required | The uuid of the site where the plugin is requested to uninstall. |
Response
{
"status" : 200, // or error code
"Message" : 'Success' // or error message
}