MeetMax API Request

String httpMethod = 'GET'; String serviceUrl = 'http://staging.meetmax.com/sched/service/event/list'; String consumeKey = 'xxxxx'; String otherParams = ''; //If we are making calls that need other parameters String consumeSecret = 'yyyyy'; String sigMethod = 'HMAC-SHA1'; String oauthVer = '1.0'; String timeStamp = String.valueOf(System.now().getTime()); //get Current Time as Epoch Timestamp String nonce = String.valueOf(Integer.valueOf(10000000/Math.random())); //Random number for Nonce //Concatenate Strings to get Signature Base String String[] baseStrArry = new String[]{httpMethod, serviceUrl, ('oauth_consumer_key='+consumeKey), ('oauth_nonce='+nonce), ('oauth_signature_method='+sigMethod), ('oauth_timestamp='+timeStamp), ('oauth_version='+oauthVer)}; //Join base string with Ampersands String baseStr = String.join(baseStrArry,'&'); //URL encode baseString String baseStrEnc = EncodingUtil.urlEncode(baseStr,'UTF-8'); //To generate digest value String salt = baseStrEnc; String key = consumeSecret+'&'; Blob data = crypto.generateMac('hmacSHA1',Blob.valueOf(salt), Blob.valueOf(key)); //Get base64 encoded String String encSig = EncodingUtil.base64Encode(data); //send request Http h = new Http(); HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setEndpoint('http://staging.meetmax.com/sched/service/event/list'); //Concatenate OAuth header string String[] headSecStrArry = new String[]{('oauth_consumer_key="'+consumeKey+'"'), ('oauth_signature_method="'+sigMethod+'"'), ('oauth_signature="'+EncodingUtil.urlEncode(encSig,'UTF-8')+'"'), ('oauth_timestamp="'+timeStamp+'"'), ('oauth_nonce="'+nonce+'"'), ('oauth_version="'+oauthVer+'"')}; String headSecStr = String.join(headSecStrArry,','); req.setHeader('Authorization','OAuth '+headSecStr); HttpResponse res = h.send(req)
To Create a MeetMax Request in Apex

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.