如何在REST API中传递会话确认号?

时间:2016-06-03 08:15:20

标签: web-services rest atg

http://username:password@siteaddress.com/rest/model/atg/userprofiling/ProfileActor/create?_dynSessConf=1161953573111590000&email=t3June0@yopmail.com&password=project@3June0&confirmPassword=project@3June0

即使在通过会话确认号码后,我也收到以下错误

您的会话由于不活动而过期。

当我使用Curl命令时,这个问题不会出现。

1 个答案:

答案 0 :(得分:0)

此问题是否已解决?,您的Login API是否有效?你在哪里使用这个ATG API(用于移动或门户网站)?

答案适用于门户网站。

  

此错误是因为会话确认编号不匹配。

使用此代码检索会话确认号。

var xmlHttp = new XMLHttpRequest();
        xmlHttp.open( "GET", "http://IP:Port/rest/model/atg/rest/SessionConfirmationActor/getSessionConfirmationNumber", false ); // false for synchronous request
        xmlHttp.send(); 
        var hostResponse=xmlHttp.responseText.split(" ");
        localStorage.setItem("getSessionConfirmationNumer",hostResponse[1].replace("}", ""));

会话确认号很大,如果您使用json检索相同的号码,则号码将分配给LONG。

请检查并告知。祝你好运:)