Is there a way to get differences between bundles thought API

Options
arielma2304
arielma2304 Registered Posts: 47 ✭✭✭✭

Hi

I saw in the DSS UI, that for each bundle details there is tab of 'log' and 'diff' compared to the previous version.

Is it possible to get this info thought python API?

bundle-release-notes

Best Answer

  • AndrewM
    AndrewM Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer Posts: 20 Dataiker
    edited July 17 Answer ✓
    Options

    Hi,

    There is not a direct Python API that will include the change log. While there is a Python API to list the exported bundles, list_exported_bundles(), this API will not include the change log. There is however a REST API endpoint that will list the change log, /projects/{project key}/bundles/{bundle id}. Using this we can construct a call to the REST endpoint through Python. I've included some example code below, you may have to make some adjustments to get it working in your environment.

    import dataiku
    import pprint
    import requests
    
    host='YOUR DSS HOST'
    bundle="YOUR BUNDLE ID" #bundle Id
    project = 'YOUR PROJECT KEY' #projet key for the bundle
    apikey='YOUR API KEY' #Use an API key that has access to the project
    
    #Open a REST session and send the API key
    session = requests.Session()
    session.auth = (apikey, '')
    
    #Send a REST GET request to the bundles endpoint
    auth = session.post(host)
    response = session.get(host +'/public/api/projects/'+project+'/bundles/exported/'+bundle)
    
    #Get the JSON
    jsonResponse = json.loads(response.text)
    
    #Print the changelog
    print(jsonResponse["changelog"])

    While not a direct Python API, this should workaround the API limitation. You will need to generate an API key for this. You can find more information on that here: https://doc.dataiku.com/dss/latest/publicapi/keys.html.

    Thank you

    Andrew M

Setup Info
    Tags
      Help me…