Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Exporting data tables via API

    Posted 11-06-2023 05:10
    Edited by Andrew Appleton 11-06-2023 23:59
    No replies, thread closed.

    I am trying to export data tables using the API, specifically using the GC tool.  The problem I'm having is accessing the data table CSV file after creating the job.

    Example: 

    andrewa@rem-andrewa-m.local:ara $ gc flows datatables export jobs create xxxxxxxx-f35e-4853-b125-c2ba1f4200d4
    {
      "id": "xxxxxxxx-2e46-4b9e-b131-b421887fb729",
      "owner": {
        "id": "xxxxxxxx-9032-4c5b-8a16-15dbbb16d152",
        "selfUri": "/api/v2/users/xxxxxxxx-9032-4c5b-8a16-15dbbb16d152"
      },
      "status": "Processing",
      "dateCreated": "2023-11-06T09:53:37Z",
      "countRecordsProcessed": 0
    }

    This succeeds, and I can the get the status of the job, which returns a URL to download the CSV file from:

    andrewa@rem-andrewa-m.local:ara $ gc flows datatables export jobs get xxxxxxxx-f35e-4853-b125-c2ba1f4200d4 xxxxxxxx-2e46-4b9e-b131-b421887fb729
    {
      "id": "xxxxxxxx-2e46-4b9e-b131-b421887fb729",
      "status": "Succeeded",
      "dateCreated": "2023-11-06T09:53:37Z",
      "dateCompleted": "2023-11-06T09:53:37Z",
      "downloadURI": "https://api.mypurecloud.de/api/v2/downloads/xxxx73317bf9ec0a",
      "countRecordsProcessed": 6
    }

    I can access this file simply using my browser as I'm already authenticated, but how do I pull the file (e.g., curl or wget)?  What authentication token do I need to use?

    Simply attempting to pull the file using curl or wget does not work, so I assume it needs an authentication token, I just do not know what to provide.  I have tried passing username/password in both plain text and also in base64 using Curl.

    Sorry if this is a n00bie question!

    #Integrations
    #SystemAdministration

    ------------------------------
    Andrew Appleton
    Genesys - Employees
    ------------------------------



  • 2.  RE: Exporting data tables via API

    Posted 01-01-2024 20:37
    No replies, thread closed.

    I have not tried myself, but I assume it is similar to recordings:  Download Recordings (genesys.cloud)

            // Download Recordings
            private static void downloadRecording(BatchDownloadJobResult recording)
            {
                Console.WriteLine("Downloading now. Please wait...");

                String conversationId = recording.ConversationId;
                String recordingId = recording.RecordingId;
                String sourceURL = recording.ResultUrl;
                String errorMsg = recording.ErrorMsg;

                String targetDirectory = ".";

                // If there is an errorMsg skip the recording download
                if(errorMsg != null) {
                    Console.WriteLine("Skipping this recording. Reason: " + errorMsg);
                    return;
                }

                // Download the recording if available
                String ext = getExtension(recording);

                string filename = conversationId + "_" + recordingId;

                using (WebClient wc = new WebClient())
                    wc.DownloadFile(sourceURL, targetDirectory + "\\" + filename + "." + ext);
            }



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Exporting data tables via API

    Posted 01-02-2024 07:15
    No replies, thread closed.

    Thanks, Robert,

    I can certainly take a look at this approach, but was more interested in managing this through the available utility, Genesys Cloud API CLI (gc).  I've found how to do this using the tool, but it is quite complicated and requires multiple steps... detailed here: https://developer.genesys.cloud/forum/t/exporting-datatables-via-platform-api-cli/23166/2

    My understanding is that product team are considering improvements to how this is handled, but I have no further information than that.



    ------------------------------
    Andrew Appleton
    Genesys - Employees
    ------------------------------



  • 4.  RE: Exporting data tables via API

    Posted 01-02-2024 13:05
    No replies, thread closed.

    Two things that the Genesys API is really missing are CRON triggers and File Manipulation so we can copy and move files using Genesys instead of an outside service.  



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------