You are not logged in.
Pages: 1
Hi There,
I am trying to instantiate the API object in an json request, but I always get "undefined" error
var objAPI = new IMS.API({imsHost:"mythirdlightserver.com"});
could you please advise me whats wrong with the above statement.
Regards
Satish
Offline
Hi Satish,
You need to include the definition of the IMS API client, and the supporting library - in the case of Third Light's published Javascript clients, this would be either Prototype or JQuery. (See the "Invoking the client" section of the documentation page at https://www.thirdlight.com/docs/display … ipt+Client).
Dominic
Offline
Thanks Dominic,
I have tried the javascript client as mentioned in your previous reply, but I am not able to login through the script -
myIMSClient.Login("myid", "mypassword");
after the above statement, javascript throws an error- the error is as below
-----------
ims-api-1.1.js (line 613)
TypeError: document.getElementsByTagName(...)[0] is undefined
document.getElementsByTagName('body')[0].appendChild(scriptTag);}
-------------
Please find the complete script- I am trying to login and adding note to the image file whose reference is 26490552737. Please advise where things going wrong.
Thanks
Satish
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<!-- Prototype library. See http://www.prototypejs.org/ -->
<script src="http://myserver.thirdlight.com/j/external/prototype-1.7.0.0.js"></script>
<!-- IMS API Client -->
<script src="http://myserver.thirdlight.com/j/external/ims-api-1.1.js"></script>
<script>
var myIMSClient = new IMS.API({ "imsHost": "http://myserver.thirdlight.com/","syncWithWebSession":"false" });
// var mySessionId = "E63YFVPkGTiw3BLPJYAtMeo8bk1w39qq";
//myIMSClient.setSessionId(mySessionId);
myIMSClient.Login("myid", "mypassword");
myIMSClient.request("Files.AddHistoryNote", { "assetId":"26490552737","note": "This is a note" },
{
onSuccess: function (e) {alert('success');},
onFailure: function (e) {alert('failed');}
});
myIMSClient.observeSuccess("Files.AddHistoryNote", function (e) {
var apiResponse = e.memo.response;
alert("A history note has been added to the file with ID:" +
apiResponse.assetId +
" The new history note has ID: " +
apiResponse.historyNoteId);
});
</script>
</head>
<body>
</body>
</html>
Offline
Pages: 1