Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Trouble copying an App

Hello everybody,

I'm not being able of copying an app from the engine API. I need to be able to override an App content (sheets, variables, etc) with the content of a different App.

That is, if I have app A, whose id is xxx-xxx-xxx and app B, whose id is yyy-yyy-yyy, I need to be able to pass variables and sheets from B to A, but keeping A's id xxx-xxx-xxx and keeping the data previously load.

I pass the following request:

{"handle": -1,"method": "CopyApp","params": {"qTargetAppId": "1469f966-ad1c-4e6e-807a-c712857429b3",

"qSrcAppId": "22e7838f-f734-4eac-92e7-643dc84a8d28","qIds": ["mXgZa"]}}

Where "1469..." is the target app, "22e..." is the source app and "mXgZa" is the id of the sheet contained in the source app that I want to copy into the target app. I get following error:

{

    "error": {

        "code": 9003,

        "message": "Resource not found",

        "parameter": "Engine ID not found"

    },

    "id": 0,

    "jsonrpc": "2.0"

}

The only thing I can do to get rid of the error is remove the content "mXgZa" from the qIds field. in that case I get sucess but of course, it does nothing.

As far as I understand, it should work since "mXgZa" is the identifier of the sheet. I have not been able so far to find out what is wrong there. I hope somebody can help me aorund here.

Thanks in advance!

11 Replies
bekahbeets
Creator
Creator

I also need an answer to this.

ErikWetterberg

Hi,

The CopyApp method should have the QRS (Repository) ID as parameters, not the engine ID's. Check out the CopyApp documentation for information on how to find this.

Erik Wetterberg

bekahbeets
Creator
Creator

What do you mean by QRS ID?

The ID I put in is the ID(s) of the app(s) in the QMC... Is this not what I'm supposed to use?

bekahbeets
Creator
Creator

When i run the api call against the qrs... it gives me the same id as what is listed next to the app in the qmc, which is what I was  using and getting the 9003 error.

ErikWetterberg

Hi Rebekah,

I don't know what ID you are using but in the example above the ID "mXgZa" is most likely wrong. It looks like a client generated ID (they are short), but what you need is the QRS ID, It might look something like this:

AppObjectsId.PNG

Erik Wetterberg

bekahbeets
Creator
Creator

Hey Erik,

That is not supposed to be the id of an app... what goes there are the qid's of the objects in an app..sheets, variables, etc. The id's of the empty app already created is the 'target app' and the app to be copied is the 'src app'.

My understanding so far is that they are the qInfos associated with the app being copied over. If this is an empty string, it defaults to copying everything over.

I could be wrong as I am new to the qlik engine api, but i have made other calls successfully from node. I don't know if I am doing it wrong or missing something I need. I get the same error on ReplaceAppWithID call.

https://help.qlik.com/en-US/sense-developer/September2017/Subsystems/EngineAPI/Content/Classes/Globa...

I am so stuck.

ErikWetterberg

Hi,

There are 3 IDs in the example. The first two are apps, and works, but the third one should be a sheet. In the AMC you find sheets together with stories under App objects. This is the page the screen dump shows, though I have made changes in what columns are shown and filtered to only show sheets.

If you feel stuck you could always try to do the same operation in the hub and look at the messages on the web socket.

Hope this helps

Erik Wetterberg

bekahbeets
Creator
Creator

Hey Erik,

I now have access to the App Objects in the QMC (took a bit for my permissions to be arranged). I have done the following things:

Created a basic app to act as the source. It contains 1 bar chart on 1 sheet.

Created an empty app to act as the target.

I then run the GetAllInfos command from the engine API explorer to get the 3 qID's associated with the source.

I then run this:

{

  "handle": -1,

  "method": "CopyApp",

    "params": {

       "qTargetAppId": "fb3f9562-8a89-4440-b1e3-b06c971d9ce2",

       "qSrcAppId": "5dafefcc-9b2f-41f0-9de4-efea3e4ccfdc",

    "qIds": [

       "LoadModel",

       "7831f974-c853-4cc4-8cc0-58321dfa2878",

       "FWUJNb"

     ]

  }

}

and I still get Engine error 9003

ErikWetterberg

HI,

And if you try with just one of the id's? Does that work?

Erik Wetterberg