-
-
Save snugsfbay/9966ae0377acd55cffcaa3e920e6e0b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String key = 'hgdhdhhdjfh12ehsn'; | |
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk'; | |
//Generating current Unix timestamp (in seconds) | |
String getTime = string.valueOf(Datetime.Now().getTime()/1000); | |
String requestInput = key + secret + getTime; | |
Blob requestBlob = Blob.valueOf(requestInput); | |
Blob hash = Crypto.generateDigest('MD5', requestBlob); | |
//Need to convert into hex to generate the equivalent of md5(string) method of PHP. | |
String requestSignature = EncodingUtil.convertToHex(hash); | |
http h = new Http(); | |
HttpRequest req = new HttpRequest(); | |
//For security purpose, actual have been replaced with dashes | |
req.setEndpoint('https://www.---------/api/v1/-----/search?address=10313%2BSW%2'); | |
req.setMethod('GET'); | |
req.setHeader('Api-Key', key); | |
req.setHeader('Api-Signature', requestSignature); | |
HttpResponse res = h.send(req); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment