1

Is there a way to set a process to automatically copy a presentation from folder to another?

I want to set a schedule that moves a copy of a presentation from my pre-prod folder to my prod folder. I want it to overwrite the copy every time. Is there a way to do this via the API or some other method?

2 replies

null
    • Senior Director of Product
    • Ian_Macdonald
    • 2 wk ago
    • Reported - view

    Hi 

    Unfortunately no, not in the general UI. This could be achieved using the Pyramid API (https://help.pyramidanalytics.com/Content/Root/developer/reference/APIs/REST%20API/API3/content/changeItemFolder.htm?tocpath=Tech%20Reference%7CAPIs%7CMain%20API%20and%20SDKs%7CAPI%203.0%20Methods%7CContent%20APIs%7C_____6) though and writing your own scheduling routine.

    • Eduart_Jazaj
    • 2 wk ago
    • Reported - view

    Hi  , 

    This can be accomplished, here are some API’s that will help, scripted in Python:

    Step 1:  Authentication – First step would be to generate a token which is required to execute the rest of the steps.

    ·         Authenticate via API /API3/authentication/authenticateUser

    import requests
    import pandas as pd
    import pprint
    import json
    
    
    url_base = "https://xxx.sourcepyramid.com"
    request_url = url_base + "/API3/authentication/authenticateUser"
    
    aUser="EnterYourUser"
    password = "EnterYourPassword"
    
    data = {
            'userName':aUser,
            'password':password
            }
    
    
    response = requests.post(request_url, data=json.dumps(data))
    
    
    token=response.text
    

     

    Note: Update url_base to your specific pyramid URL. Insert your username and password on aUser and password

     

    ·         Alternatively, copy the token from pyramid home page (System Info)

     

    Step 2: Export Content from source pyramid environment (Pre-Prod, for example)

    data=['IdOfItemToBeExported']
    
    url_base = "https://xxx.sourcepyramid.com"
    request_url = url_base + "/API2/content/exportContent"
    
    header = {'auth':token, 'data': data}
    
    response = requests.post(request_url, data=json.dumps(header))
    
    export_pie = response.json()
    
    

     

    Step 3: Follow Step 1 to get token for the destination environment (for example: Prod Environment)

    Step 4: Import Content to target Pyramid environment (Prod, for example)

    url_base = "https://yyy.targetpyramid.com"
    request_url = url_base + "/API2/content/importContent"
    
    destinationFolderID='IDofDestinationFolder'
    data_export=export_pie['data']
    
    data = {
            'fileZippedData':data_export,
            'rootFolderId':destinationFolderID
            }
    
    header = {'auth':token, 'data': data}
    
    response = requests.post(request_url, data=json.dumps(header))
    
    print(response)
    

     

    Step 5: Update Data Source

    url_base = "https://xxx.sourcepyramid.com"
    request_url = url_base + "/API2/dataSources/changeDataSource"
    
    
    dscApiData = {
        'fromConnId':'CurrentConnectionStringID' ,
        'toConnId':'TargetConnectionStringID'  ,
        'itemId':'IDOfImportedItem'
            }
    
    
    header = {'auth':token, 'dscApiData': dscApiData}
    response = requests.post(request_url,  data=json.dumps(header))
    
    print(response)
    print(response.content)
    

     

    Note: CurrentConnectionStringID and TargetConnectionStringID can be extracted with /API2/dataSources/getAllConnectionStrings

     

    I will follow up with you directly to accomplish this. 

Content aside

  • Status Answered
  • 1 Likes
  • 2 wk agoLast active
  • 2Replies
  • 37Views
  • 3 Following