3. Update White Label

3. Update White Label

Definition

This  POST  API is used to update the colors and support numbers as well as upload your favicon and cover image for white labeling the candidate test windows in your account. Only authorized accounts can use this API. To use this API, please contact your Account Manager.
      *PDF documentation reference - Section 2.3 White labelling Settings in Account

Query Parameters

In our REST APIs, Query Parameters have to be URL encoded as the data is being transmitted in the request URL. This is especially important for the  asgn  parameter and any parameters with JSON as they always contain characters that need to be URL encoded. Since  ak  and  ts   parameters don't contain any characters that need to be URL encoded, URL encoding of these parameters can be skipped.

Mandatory parameters


Query Parameter


Description

ak

This is your Public-API-Key, which Mettl uses to identify your account.

ts

This is the current UNIX or Epoch Timestamp (the number of seconds between 1970-01-01 00:00:00 and current UTC Time). Any current generated Timestamp will be valid for 24 hours only.

asgn

This is a unique Signature which has to be generated  for each API request .

The Signature is generated by creating a String-to-Sign and hashing it with your Private-API-Key using the HMAC-SHA256 (for version v2 and v3) or HMAC-SHA1 (for v1) hashing algorithm with Base-64 and URL encoding.

Read more about the above Signature Generation Process in API Authentication and Signature Generation.

wl

This is a JSON string containing the details the colors to be used for white labeling along with custom test URL of your account. The format for the JSON can found below.


 POST  request syntax with mandatory parameters:
https://api.mettl.com/v2/account/update-white-labeling?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}&wl={White-Labeling-JSON}

Optional parameters


Query Parameter


Description

sn

The list of support numbers you want to update to your account. You can add up to 2 support numbers in the given JSON format.

eg. ["+1-650-924-9221" , "+91-82878-0340"]


 POST  request syntax with mandatory parameters:
https://api.mettl.com/v2/account/update-white-labeling?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}&wl={White-Labeling-JSON}&sn={Support-Numbers-JSON}

Body Form-Data

Only supported in multipart/form-data requests. All form-data fields are irrelevant for the signature generation process.

Optional fields


Query Parameter


Description

fav

This is the favicon icon or logo which appears in the browser tab. You can add an image file with the following properties-
  1. Accepted logo formats: png and ico
  2. Maximum logo size: 10 Kb
  3. Recommended size: 8x8px
cov

This is the cover image which appears in the background before the test starts. You can add an image file with the following properties-
  1. Accepted logo formats: jpeg, jpg, png and gif
  2. Maximum logo size: 2 Mb
  3. Recommended size: 1920x1080px 

JSON ( wl )

Format of JSON string to be passed in query parameter  wl  can be found in the table below. This JSON describes the details of the details the colors to be used for white labeling along with custom test URL of your account.
Note: There are no mandatory  properties  for  wl  JSON below.

PropertyDescription
headerBackgroundColorBackground color of the header in your tests. This value is a string and accepts a valid Hex color code without the # symbol.
headerFontColorFont color of the header in your tests. This value is a string and accepts a valid Hex color code without the # symbol.
buttonColorBackground color of the buttons in your tests. This value is a string and accepts a valid Hex color code without the # symbol.
buttonFontColorFont color of the buttons in your tests. This value is a string and accepts a valid Hex color code without the # symbol.
customTestUrlCustom string following the URL "https://tests.mettl.com/" for accessing the tests in your account. This value is a string.

For easier readability, the sample  wl  JSONs below has pretty formatting, but in your actual request and for signature generation, they should be ideally minified.
Sample  wl  JSON with all properties:
{
"headerBackgroundColor": "4C4794",
"headerFontColor": "ffffff",
"buttonColor": "ef75ab",
"buttonFontColor": "ffffff",
"customTestUrl": "Company-Name"
}

Example

Request without Signature
a.1.  POST  request URL, with queries  ak  ,  ts  ,  wl  and  sn  but without  asgn  (Signature)
https://api.mettl.com/v2/account/update-white-labeling?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&wl=%7B%22headerBackgroundColor%22%3A%224C4794%22%7D&sn=%5B%22%2B91-82878-0340%22%5D
a.2.  POST  request body with multipart/form-data  fav  and  cov 
fav: 'favicon.ico'
cov: 'cover.jpg'

b. Creating a String-to-Sign, calculated with Method + Endpoint + Values of query parametersin new lines and in ascending order of the parameter name (i.e., the new line characters "\n" followed by values of  ak  ,  sn  ,  ts  and  wl  in order, for this example)
String-to-Sign = "POST" +  "https://api.mettl.com/v2/account/update-white-labeling"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "["+91-82878-0340"]" + "\n" + "1635976200" + "\n" + "{"headerBackgroundColor":"4C4794"}"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
["+91-82878-0340"]
1635976200
{"headerBackgroundColor":"4C4794"}
d. Private-API-Key to sign/hash the above Sting-to-Sign using HMAC-SHA256 (since API version is v2)
zy98x765-4321-0987-654w-32v1u0987654
e. Output of the generated Signature for  asgn  using the Sting-to-Sign and your Private-API-Key, hashed with HMAC-SHA256 (Base-64 and URL Encoded)
6GdB3azL4Q466GN0RGL21vxWchcZgzhklOXDRy8LSYY%3D
Read more about the above Signature Generation Process in API Authentication and Signature Generation

Request with Signature
f.1. Final  POST  request URL with queries  ak  ,  ts  ,  wl  ,  sn  and  asgn  (URL Encoded)
https://api.mettl.com/v2/account/update-white-labeling?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&wl=%7B%22headerBackgroundColor%22%3A%224C4794%22%7D&sn=%5B%22%2B91-82878-0340%22%5D&asgn=6GdB3azL4Q466GN0RGL21vxWchcZgzhklOXDRy8LSYY%3D
f.2.  POST  request body with multipart/form-data  fav  and  cov 
fav: 'favicon.ico'
cov: 'cover.jpg'

Response

Upon making a successful request, if there are no errors, you will receive a JSON in the given format
{
    "status": "SUCCESS"
}