Signing Vembu BDR API request with signature
This section describes how to create signature and add it to a Vembu BDR API request.
Below example illustrates, how an API request might looks like:
http://<IPAddress/Hostname>:6060/bdrwebservices.php {“Action”:”LIST_BACKUPS”,”UserName”:”admin”,”Signature1”:”6cd32224ed0ac070f34121b70830b97b6d3ca55181508c8e95b0f9e78f84bfec”,”SignatureVersion”:2,”LoginTime”:”1497704250”} |
Summary of Signing Steps
To create a signed request, complete the following.
Task 1 : Create a API request
Task 2 : Create a Secret Key
Task 3 : Create a signature for the API request
Task 4 : Add the signature information to the API request
Create a API request
Create API request in a standardized format, this ensure that when Vembu BDR receives API request, it calculate the same signature that you have calculated.
Follow the steps here to create API request, otherwise request calculated by you and request created by Vembu BDR won’t get matched and request will get denied.
API standardized format
API request = HTTPRequestMethod APIURI QueryString Signature |
Example API request
API request = Post http://192.168.100.235:6060/bdrwebservices.php {"UserName":"admin","Signature1":"6cd32224ed0ac070f34121b70830b97b6d3ca55181508c8e95b0f9e78f84bfec","SignatureVersion":2,"LoginTime":"1497704250","Action":"LIST_BACKUPS"} |
Start with the HTTP request method, (GET, PUT, POST, etc.)
VembuBDR uses POST request method for all API calls and the POST data should be in JSON format.
The Endpoint URL structure for the requests to be made is as follows:
http://machine_name(or)machine_ip:port/bdrwebservices.php
Query String Parameters
Pseudocode for deriving a Secretkey
To create the secretkey, concatenate algorithm and login time as shown in the following format.
Secretkey= algorithm+login time |
Following example shows how to construct secretkey
To create Secretkey
For password admin : md5(admin)=21232f297a57a5a743894a0e4a801fc3 |
1497704250 |
3. Append algorithm value with login time value to create Secretkey.
21232f297a57a5a743894a0e4a801fc31497704250 |
Create the signature for the API request
Signature is the process of adding authentication information to VembuBDR API request.
Before you calculate the signature, make sure you have created secret key specified at step 2, deriving secret key is specific to the login time which will add extra protection to the API request.
Pseudocode for deriving a signature
Signature = hmac_sha256("<Secretkey>", "<ActionName>") |
The following example shows the resulting signature if you use the same secret key and action name LIST_BACKUPS followed in this document.
6cd32224ed0ac070f34121b70830b97b6d3ca55181508c8e95b0f9e78f84bfec |
Add the signature information to the API request
After you calculate the signature, final thing you need to do is adding it to HTTP header named “Signature”
Following examples shows a finished API request.
http://192.168.100.235:6060/bdrwebservices.php {"UserName":"admin","Signature1":"6cd32224ed0ac070f34121b70830b97b6d3ca55181508c8e95b0f9e78f84bfec","SignatureVersion":2,"LoginTime":"1497704250","Action":"LIST_BACKUPS"} |
How Signature works?
When VembuBDR server receives any API request, it will applies the same algorithm which you have used to generate the signature, if the signature matches then request will get processed otherwise request will get denied.