Lokdon API

LokDon ECSMID V 1.0.0 (AMI)

Description

LokDon exposes a REST API on port 8000. To test the API endpoints, you can use the built-in swagger testing tool or PostMan.

Prerequisites

Authorization Token: Bearer <token>


PostMan Tool (optional): If you want to test the API using postman, install
this tool on your system.

Authorization

LokDon Image requires an authentication token that is provided with your LokDon enterprise license.

The authentication header should be sent as a bearer token on each REST api request.

				
					auth": { 

    "type": "bearer",

     "bearer": [ { 
    
         "key": "password",
        
         "value": "{{YOUR_LOKDON_LICENSE_KEY}}",
        
         "type": "string"
    
     } ]

 }
				
			

TESTING API’s LIST

1 . Testing /encrypt/generic

2 . Testing /Decrypt/generic

3 . Testing /Encrypt/password

4 . Testing /Decrypt/password

5 . Testing /Encrypt/PIN

6 . Testing /Decrypt/PIN

7 . Testing /Encrypt/Binary (For File Encryption)

8 . Testing /Decrypt/Binary (For File Decryption)

Testing Application Ex

Swagger-UI

Swagger-UI

Postman

Postman

Postman

Postman

Postman

Postman

Setting the built-in Swagger-UI

  • Open any browser and navigate to :8000/swagger-ui/
    for example: http://34.217.137.93:8000/swagger-ui/
  • Click on the api-controller link
  • Choose one of the APIs to test To test the APIs you need a test authentication token from LokDon.

Setting the POSTMAN

  •  Open postman and navigate to collection => LokDon SDK
  • Select type as Bearer Token under Authorization tab
  • Setup the toke. value received from LokDon under variable tab

1 . Testing /encrypt/generic

Expand the encrypt/generic API and click on “try it out” button

In the Authorization input, enter the authentication token as follows

“Bearer <your-token>”

In the body section, change the default string in quotes to something you
want to test, or test the default provided text.

Finally, click execute and you should see the encrypted response as below.

2 . Testing /Decrypt/generic

Repeat the same process for encryption steps above, except change the body to the cipher-text returned from the encryption response above.

Make sure to copy the encrypted text from response body of the previous request:

Enter the encrypted cipher-text to the decryption body as follows

Once done, click on execute button and API should respond with the original text that you encrypted.

3 . Testing /Encrypt/Password

To Encrypt Password, Select the Encrypt password, Change the Method To POST and enter the designated URL
In the body section, change the default string in quotes to something you want to test, or test the default provided text.

Finally, click Send and you should see the encrypted response as below.

4 . Testing /Decrypt/Password

Repeat the same process for encryption steps above, except change the body to the cipher-text returned from the encryption response above.

Make sure to copy the encrypted text from response body of the previous request, Enter the encrypted cipher-text to the decryption body as follows

Once done, click on Send button and API should respond with the original text that you encrypted.

5 . Testing /Encrypt/PIN

To Encrypt PIN, Select the Encrypt PIN, Change the Method To POST and enter the designated URL
In the body section, change the default string in quotes to something you want to test, or test the default provided text.

Finally, click Send and you should see the encrypted response as below.

6 . Testing /Decrypt/PIN

Repeat the same process for Encryption steps above, except change the body to the cipher-text returned from the encryption response above.

Make sure to copy the encrypted text from response body of the previous request, Enter the encrypted cipher-text to the decryption body as follows

Once done, click on Send button and API should respond with the original
Text that you encrypted.

7 . Testing /Encrypt/Binary (For file encryption)

To Encrypt Binary (File Encryption), Select the Encrypt Files, Change the Method To POST and enter the designated URL
In the body section, Select form-data and upload those file which you want to encrypt (can be single or multiple), and click SEND.

After clicking send, the response contains Link to individual Encrypted file As shown

Now Select GET Method and follow the individual link and click SEND
respectively to get a final encrypted response

Now click Save response -> save to a file, to save the encrypted file on your local.

8 . Testing /Decrypt/Binary (For file Decryption)

To Decrypt Binary (File Decryption), Select the DecryptFiles, Change the Method To POST and enter the designated URL
In the body section, Select form-data and upload the file which you want to Decrypt (can be single or multiple), and click SEND.

After clicking send, the response contains Link to individual Decrypted file As shown

Now Select GET Method and follow the individual link and click SEND respectively to get a final Decrypted response

Now click Save response -> save to a file, to save the Decrypted file on your local.

Error Handling

In the case of an error, there will be an error code response from the image based on the error type. Most of the error codes are in accordance with the HTTP response standard.

Error Code Error Reason
400 Bad Request Missing headers
401 Authentication Failed The provided Java Web Universal Wallet Address Tokenis wrong or invalid
403 Unauthorized Resource included in your LokDon License
404 Resource unavailable Either the wrong endpoint or problem with deployment
429 Too many requests Requests exceeded the rate limited by your license