Hi there,
For temporarily, timezone Id can be updated through Java SDK but not language, since these two settings are often be changed, you can use Rest API method instead.
Below is the sample code I created for you:
private void updateSenderLanguageAndTimezone(String api_url, String api_key, String senderId, String language,
String timezoneId) throws IOException {
URL sourceClient = new URL(api_url + "/account/senders/" + senderId);
HttpURLConnection sourceConn = (HttpURLConnection) sourceClient.openConnection();
sourceConn.setRequestProperty("Content-Type", "application/json; esl-api-version=11.21");
sourceConn.setRequestProperty("Accept", "application/json; esl-api-version=11.21");
sourceConn.setRequestProperty("Authorization", "Basic " + api_key);
sourceConn.setRequestMethod("POST");
sourceConn.setDoOutput(true);
sourceConn.setDoInput(true);
String payloadJSON = "{ \"language\": \"" + language + "\",\"timezoneId\": \"" + timezoneId + "\"}";
System.out.println(payloadJSON);
OutputStream os = sourceConn.getOutputStream();
os.write(payloadJSON.toString().getBytes());
os.flush();
os.close();
int sourceResponseCode = ((HttpURLConnection) sourceConn).getResponseCode();
if (sourceResponseCode != 200) {
Reader ir = new InputStreamReader(sourceConn.getErrorStream());
BufferedReader in = new BufferedReader(ir);
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
sourceConn.disconnect();
throw new RuntimeException(response.toString());
}
}
Sample Usage:
updateSenderLanguageAndTimezone("API_URL", "API_KEY", "sender_id", "fr", "GMT");
Duo LiangOneSpan Evangelism and Partner Integrations Developer
Reply to: Update sender language and time zone
Thursday, January 3, 2019 at 08:53amDuo Liang OneSpan Evangelism and Partner Integrations Developer