[YMCS/YDMP Free Trial Program]Yealink would like to offer Free Trial Program of Yealink device management service for our current eligible customers. You can see the details below.
https://www.yealink.com/ydmp-freetrial-2020


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RPS API - Authentication Error
Author Message
wecloudit Offline
Junior Member
**

Posts: 6
Joined: Feb 2019
Reputation: 0
Post: #6
RE: RPS API - Authentication Error
(03-13-2020 06:01 AM)TeleCloud Wrote:  
(01-06-2020 02:35 PM)bmueller Wrote:  
(11-22-2019 12:08 AM)jrmende5 Wrote:  Good day.

I am working on connecting to the RPS API using the new version (REST server using Access Key and Access Key Secret) from POSTMAN.

But I receive the error: 401 - signature.invalid

I attach the code in postman (Pre-request script):

function getTimestp(){
dt = new Date();
return dt.getTime();
}

function getNonce(){
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4();
}


xkey = "AccessKey";
xsecret = "SecretKey";
xtimest = getTimestp();
xnonce = getNonce();

xheaders = "X-Ca-Key:"+xkey+"\n"+"X-Ca-Nonce:"+xnonce+"\n"+"X-Ca-Timestamp:"+xtimest;

param = pm.request.body.formdata;
dp = Object.values(param);
lg = dp[0];

stparam = "";

for(i=0;i<lg.length;i++){
aPam = lg[i];

equal = "=";
if(aPam["value"] === ""){
equal = "";
}

if(i+1 == lg.length){
stparam += aPam["key"]+equal+aPam["value"];
}else{
stparam += aPam["key"]+equal+aPam["value"]+"&";
}
}


stringToSign = "POST\n"+xheaders+"\n"+pm.request.url.getPath()+"\n"+stparam;

signatureutf8 = CryptoJS.enc.Utf8.parse(stringToSign);
secretByteArray = CryptoJS.enc.Utf8.parse(xsecret);
signatureBytes = CryptoJS.HmacSHA256(signatureutf8,secretByteArray);
requestSignatureBase64String = CryptoJS.enc.Base64.stringify(signatureBytes);

pm.environment.set("signature",requestSignatureBase64String);

Did you ever get this solved? I am having the same issues...

Anyone get this working?
can we please have some sample code.
Thanks

We got a working PHP solution: pm me for details (will send the code)
(This post was last modified: 11-26-2020 06:40 PM by wecloudit.)
11-26-2020 04:53 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
Post Reply 


Messages In This Thread
RPS API - Authentication Error - jrmende5 - 11-22-2019, 12:08 AM
RE: RPS API - Authentication Error - wecloudit - 11-26-2020 04:53 PM

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Autoprovisionong T4xS v83 error gasper_s 2 7,926 11-05-2018 10:25 AM
Last Post: gasper_s
  T32G Auto provisioning error with encryption Mike89 0 5,523 09-18-2017 12:47 AM
Last Post: Mike89
  Upgrade firmware error from tftp boot server guillosur 1 9,662 05-05-2016 06:18 AM
Last Post: Karl_Yealink
  HTTPS/SSL Error nickcoons 18 72,528 02-28-2016 10:17 AM
Last Post: Novum Networks
  Incorrect File Format error on call send, receive or end call morrism 4 15,984 10-06-2015 07:37 AM
Last Post: morrism
  Auto Provisioning error AndyInNYC 1 12,554 09-10-2014 10:19 AM
Last Post: Wilson_Yealink

Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us   Yealink   Return to Top   Return to Content   Lite (Archive) Mode   RSS Syndication