Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rajesh_tup
Contributor II
Contributor II

Rest API Call with Base 64 Encode

Hi Team,

I am trying to make an API call using TRestClient to get the access token by passing a Base 64 encoded string as header, I am struggling in Base 64 Encoding and passing the value to header

Please anyone help

Labels (4)
2 Replies
Anonymous
Not applicable

You can encode and decode using a bit of Java. Here is a "Hello World" example that you can run in a tJava to test....

 

String body = "Hello world";

 

//Encoding

java.util.Base64.Encoder encoder = java.util.Base64.getEncoder();

 

byte[] bufEnc = encoder.encode(body.getBytes());

 

String strEnc = new String(bufEnc, java.nio.charset.StandardCharsets.UTF_8);

 

System.out.println(strEnc); 

 

//Decoding

java.util.Base64.Decoder decoder = java.util.Base64.getDecoder();

 

byte[] bufDec = decoder.decode(strEnc.getBytes(java.nio.charset.StandardCharsets.UTF_8));

 

String strDec = new String(bufDec, java.nio.charset.StandardCharsets.UTF_8);

 

System.out.println(strDec);

Anonymous
Not applicable

Hello @not specified not specified​ ,

Here is online tools for base64 encode and decode which may help you

https://www.base64encode.net/