Is it possible to make an API call inside `app.initialized()` in iparams.js?


I need to do an API call while loading the iparams page. I tried to do an API call with checking on parameter values in the iparams page. But I couldn’t get the value of iparams with utils.get inside app.initialized() function. Once I can get the value can I do the API call?

      function (_client) {
        //If successful, register the app activated and deactivated event callback.
        window.client = _client;
      if(utils.get('key')) callAPI();
      function (error) {
        //If unsuccessful
        console.error('APP initialized::error : ' + error);

Hey Dinesh
Can you try Installation Parameters to get iparam value of a key and then make an api call inside the .then callback

client.iparams.get("contact").then (
    function(data) {
      // success output
      // "data" is returned with the value of the "contact" attribute.
     callApi() //call the API here and chain the promises accordingly
    function(error) {
      // failure operation

Let me know if it works :smiley:


Hi @shravan.balasubraman,

It’s working fine. Thanks a lot :grinning:

1 Like