Upload file using SDK (Java)

I am looking for code samples on how to upload file using Platform API (Java SDK) for contact list ? Any code samples or link to documentation? I know it can be done using RestTemplate and other framework, but want to check the SDK support .

Hi @joematt
The public API resource for adding a contact list is POST
/api/v2/outbound/contactlists
. The corresponding Java SDK method, postOutboundContactlists, takes a ContactList object as a param, which you would need to construct programatically rather than passing in a filename or url.

If you're referring to a file type like a csv or spreadsheet, you would need to parse that and construct the body expected by the SDK. However if your file is a JSON file already in the form of the request body for that API resource, the Genesys Cloud CLI has a -f option for POST request that takes in a JSON file and uses the contents as the request body.

Thank you !. I looked at the json request for the contactlist. It has column details , but no option to pass in the actual data . In the below payload to create a contact list , where should I pass in the actual data ? As per the link -https://developer.genesys.cloud/routing/outbound/uploadcontactlists first , I have to create a contact list then upload file. I am looking for options to upload file also using SDK. If that is not supported, I can use plain java similar to mentioned here - Bad request Upload Contact Lists

{
  "name": "",
  "version": 0,
  "division": {
    "id": "",
    "name": "",
    "selfUri": ""
  },
  "columnNames": [
    ""
  ],
  "phoneColumns": [
    {
      "columnName": "",
      "type": "",
      "callableTimeColumn": ""
    }
  ],
  "emailColumns": [
    {
      "columnName": "",
      "type": "",
      "contactableTimeColumn": ""
    }
  ],
  "previewModeColumnName": "",
  "previewModeAcceptedValues": [
    ""
  ],
  "attemptLimits": {
    "id": "",
    "name": "",
    "selfUri": ""
  },
  "automaticTimeZoneMapping": true,
  "zipCodeColumnName": "",
  "columnDataTypeSpecifications": [
    {
      "columnName": "",
      "columnDataType": "",
      "min": 0,
      "max": 0,
      "maxLength": 0
    }
  ]
}

Ah I see what you mean. Thanks for clueing me in to that.
Unfortunately, there is no existing SDK method for this since the url endpoint is outside of the public API, and the SDKs are generated exclusively around the API.
You could request it to be supported by adding a new idea in the Ideas portal

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.