Jetzt verfügbar:  Berichte für DRACOONMehr Infos

Downloading whole data-room using API

Kommentare

4 Kommentare

  • Avatar
    DAVISOL - Sebastian Hübner

    Hi Vladimirs,

    Basically you're using the following flow to download several files from one data room:

    • [authenticate against DRACOON to get an (OAuth) access token]
    • [determine which nodes should be downloaded, gathering/collecting their node IDs]
    • begin a download request and pass the node IDs that should be part of the ZIP archive:
      /v4/nodes/zip
    • you'll receive a download token
    • start the download process by calling
      /v4/downloads/zip/{token}

    The workflows are described here (unfortunately, the ZIP example is missing): https://support.dracoon.com/hc/en-us/articles/115005512089-Workflows

    There might be other complications such as missing user privileges, invalid node IDs, JSON format mismatch in transmitted data or data room encryption.

    What is the response when you try the combination of /v4/nodes/zip and /v4/downloads/zip/{token}?

    HTH,

    Sebastian

    2
    Aktionen für Kommentare Permalink
  • Avatar
    Sascha Spiekermann

    I think it's easy.

    • Get all top nodes (files and folders) from the room ("/v4/nodes" with parent_id=$RoomID)
    • Pass all IDs to /v4/nodes/zip/download

    Tried it with my PowerShell module, works like a charm:

    Get-DracoonNode -connection $connection -ParentID $roomId | Get-DracoonNodeAsZip -Connection $connection -FileName "allfiles-$roomId.zip"

    Have to add some documentation to the new function and then I'll update it on Github.

    0
    Aktionen für Kommentare Permalink
  • Avatar
    Sascha Spiekermann

    Just released v1.2.4 of my PowerShell module. If you can or want to use PowerShell, this is the example code:

    $cred=Get-Credential -Message "Dracoon"
    $clientId="YOU JUST CREATED IT ;-)"
    $clientSecret="THIS ALSO"
    $url="dracoon.mydomain.com"
    $roomId=[id of the room]
    $connection=Connect-Dracoon -url $url -ClientID $ClientID -clientSecret $clientSecret -Credential $credentials
    Get-DracoonNode -connection $connection -ParentID $roomId | Get-DracoonNodeAsZip -Connection $connection -FileName "allfiles.zip"

    If not my module may help with fiddling with the API as it now does provide an extensive logging of the real API calls including masking sensitive information. Here is the output of the three commands from above: 

    Get-DracoonAPILog -Last 5 -Raw |Select-Object -ExpandProperty message
    {
    "ContentType": "application/x-www-form-urlencoded",
    "Method": "POST",
    "URI": "https://dracoon.mydomain.com/oauth/token",
    "Headers": {
    "Authorization": "Basic [BASE64_ENCODED [CLIENT_ID]:[CLIENT_SECRET]]"
    },
    "Body": {
    "username": "yourlogin@mydomain.com",
    "grant_type": "password",
    "password": "***********"
    }
    }
    {
    "ContentType": "application/json;charset=UTF-8",
    "method": "GET",
    "Uri": "https://dracoon.mydomain.com/api/v4/nodes?parent_id=1115&limit=500",
    "Headers": {
    "Authorization": "Bearer Ooorx******************"
    },
    "body": { }
    }
    {
    "ContentType": "application/json;charset=UTF-8",
    "method": "POST",
    "Uri": "https://dracoon.mydomain.com/api/v4/nodes/zip",
    "Headers": {
    "Authorization": "Bearer Ooorx******************"
    },
    "body": {
    "nodeIds": [
    133042,
    2944,
    2943
    ]
    }
    }

    The final "download" is missing in this transcript as it is not really an API call...

    1
    Aktionen für Kommentare Permalink
  • Avatar
    Vladimirs Gavriluks

    Thanks all for helping!

    Sebastian your answer was great and helpful for me!

    0
    Aktionen für Kommentare Permalink

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.