Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
pr92
Frequent Visitor

Call API as data source with parameter hash in MD5

Hello,

 

I have a GET API that I want to call to get my data.

 

In Power query, I have to send dynamic values in my GET URL : 

  • First variable : current timestamp, in the following format  YYYY-MM-DD hh:mm:ss => I managed to get something close with DateTime.LocalNow() but I have to change the format & convert it to text
  • Second variable : a concatenation of many variables, hashed in MD5

Here is the Java code provided by the API :

 

 

 

 

String text = apiToken + sTimestamp;
byte[] defaultBytes = text.getBytes();
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(defaultBytes);
byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
 String hex = Integer.toHexString(0xFF & messageDigest[i]);
 if (hex.length() == 1)
 hexString.append('0');
 hexString.append(hex);
}
String md5Text = hexString + "";
return md5Text;

 

 

 

 

Is there a way to do this in Power Query directly by any chance?

 

I tried to search for ways to hash MD5 in Power Query directly but I can't find anything.

 

Any help would be appreciated.

 

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @pr92 ,
I am not aware of native way, however, here's workaround using public API to hash it:
here's M code, you can turn it into function:

 

let
    valueToHash = "hello",
    md5 = Web.Contents("api.hashify.net", [RelativePath="/hash/md5/hex?value="&valueToHash]),
    openJson = Json.Document(md5)[Digest]
in
    openJson


edit:
I am gonna give you the function also here:

let
    hastToMD5 = (valueToHash as text)=>
    let
        md5 = Web.Contents("api.hashify.net", [RelativePath="/hash/md5/hex?value="&valueToHash]),
        openJson = Json.Document(md5)[Digest]
    in
        openJson
in
    hastToMD5

and then you call it like this: 

vojtechsima_0-1730735517563.png

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

1 REPLY 1
vojtechsima
Super User
Super User

Hello, @pr92 ,
I am not aware of native way, however, here's workaround using public API to hash it:
here's M code, you can turn it into function:

 

let
    valueToHash = "hello",
    md5 = Web.Contents("api.hashify.net", [RelativePath="/hash/md5/hex?value="&valueToHash]),
    openJson = Json.Document(md5)[Digest]
in
    openJson


edit:
I am gonna give you the function also here:

let
    hastToMD5 = (valueToHash as text)=>
    let
        md5 = Web.Contents("api.hashify.net", [RelativePath="/hash/md5/hex?value="&valueToHash]),
        openJson = Json.Document(md5)[Digest]
    in
        openJson
in
    hastToMD5

and then you call it like this: 

vojtechsima_0-1730735517563.png

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.