Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
achampire
Partner - Contributor III
Partner - Contributor III

Duplicate DataFiles and move them to another space

Hello all,

 

I am searching a way to easily duplicate DataFiles from a choosen space and move all duplications on another space (like a ctrl+c + ctrl+v on windows.

I found some Qlik Cloud Service blocks that can be interesting (like the Patch Dataset or update dataset) but I don't know if those can answer the question.

 

Do you guys have an idea to answer this need ? 

How are you using Patch Dataset and Update Dataset ?

 

Alexandre CHAMPIRÉ

 

Labels (1)
2 Solutions

Accepted Solutions
AfeefaTk
Support
Support

Hi @achampire 

Sorry for not mentioning the API methods . Please use as following:

  1. Get Id of the connection to the space - Use Get Method.
    get-connection-id-of-space.png
  2. Get id of the datafile - Use Get Method.
    get-id-of-datafile.png
  3. Copy datafile to space - Use Post Method.
    copy-data-file-to-space.png

Hope this helps!

Please let me know if you still have any further questions.

Thanks

View solution in original post

AfeefaTk
Support
Support

Hi @achampire 

Sharing the postman collection for your reference.

Please import the collection and see if that works.

Please don't forget to set up the below parameters :

  1. Authorization header -> For all the API calls.
  2. SpaceId -> For 1st API call -> get id of datafile connection in space.
  3. connectionId -> For 2nd API call -> get id of datafile.
  4. name,connectionId,sourceId -> For 3rd APi call -> copy datafile to space.

Thanks

View solution in original post

7 Replies
AfeefaTk
Support
Support

Hi @achampire 

I am not sure if the update/patch dataset blocks can be used to copy the apps to different space.

I can see an API call to change the space of the dataset. 

https://qlik.dev/apis/rest/data-files#%23%2Fentries%2Fv1%2Fdata-files%2F-id%2Factions%2Fchange-space...

We don't have a block in Qlik Cloud Services connector to do this.

But you can try using the Call URL block to make an API call.

Also if you want the dataset to be in both spaces this won't work.

I am checking internally to see if it's something achievable using the Patch dataset block or by any other means in QAA.

Thanks 

 

achampire
Partner - Contributor III
Partner - Contributor III
Author

Hi @AfeefaTk 

Thank you for your answer.

Is there a block in automation (or an API endpoint) in order to perform a data files duplication ? I guess there is one because we can do this on Qlik Cloud Hub while accessing Space detail > Data source > Data Files.

 

AfeefaTk
Support
Support

Hi @achampire 

At the moment it's not possible to achieve this using automation due to a few reasons

  1. We don't have dedicated block in the QCS connector to copy datafile to a space.
  2. Raw API Request block cannot be used as the datafiles API is not enabled in the block
  3. Call URL block cannot be used as it only allows application/json content type and the copy datafile to space API uses multipart/form-data content type.

This can be achieved using API by following the below steps

  1. Get Id of the connection to the space
    Curl Request : 
    curl --location 'https://{tenantURL}/api/v1/data-files/connections?SpaceId=space_id' \
    --header 'Authorization: Bearer xx'
  2. Get id of the datafile you wish to copy by passing the connection ID received from the above step as query parameters
    Curl Request : 

    curl --location 'https://{tenantURL}/api/v1/data-files?connectionId=connection ID' \
    --header 'Authorization: Bearer xx'
  3. Copy datafile to space using the id of the source data file, and the connectionId of the space you want to land it into
    Curl Request : 
    curl --location 'https://{tenantURL}/api/v1/data-files' \
    --header 'Authorization: Bearer xx' \
    --form 'json="{\"name\":\"test.qvd\",\"connectionId\":\"your-connection-id\",\"sourceId\":\"your-space-id\"}"'

Thanks

 

AfeefaTk
Support
Support

Hi @achampire 

I would suggest you add this feature request via ideation if you want the blocks to be in the Qlik Cloud Services connector in QAA.

https://community.qlik.com/t5/Suggest-an-Idea/idb-p/qlik-ideas

Thanks

achampire
Partner - Contributor III
Partner - Contributor III
Author

Hi @AfeefaTk 

I tried steps from your previous reply but I didn't make it work correctly.

Because I work with postman to achieve some test, I took url content of your message to find API endpoint (GET / POST or PUT was missing for example.

For the last one (3.) I make the file move from a space to my personal one despite the fact I put a space Id on my request.

 

I will request this feature via ideation as you adviced.

And I still work on the correct syntax to achieve it.

 

Thanks

AfeefaTk
Support
Support

Hi @achampire 

Sorry for not mentioning the API methods . Please use as following:

  1. Get Id of the connection to the space - Use Get Method.
    get-connection-id-of-space.png
  2. Get id of the datafile - Use Get Method.
    get-id-of-datafile.png
  3. Copy datafile to space - Use Post Method.
    copy-data-file-to-space.png

Hope this helps!

Please let me know if you still have any further questions.

Thanks

AfeefaTk
Support
Support

Hi @achampire 

Sharing the postman collection for your reference.

Please import the collection and see if that works.

Please don't forget to set up the below parameters :

  1. Authorization header -> For all the API calls.
  2. SpaceId -> For 1st API call -> get id of datafile connection in space.
  3. connectionId -> For 2nd API call -> get id of datafile.
  4. name,connectionId,sourceId -> For 3rd APi call -> copy datafile to space.

Thanks