I’m writing a short java program with the intention of updating some media info. I was able to create a KalturaClient, but it has an invalid KS. The KS looks like valid KS, but the call to mediaService.add() is throwing an exception. The full output of the program is below.
import com.kaltura.client.KalturaClient;
import com.kaltura.client.enums.KalturaMediaType;
import com.kaltura.client.enums.KalturaSessionType;
import com.kaltura.client.services.KalturaMediaService;
import com.kaltura.client.types.KalturaMediaEntry;
public class MediaInfo {
public static void main(String[] args) {
try {
KalturaClient kalturaClient = Util.getKalturaClient("******", "***", KalturaSessionType.ADMIN, ***);
System.out.println("ks=" + kalturaClient.getKs());
// add the media entry
KalturaMediaEntry mediaEntry = new KalturaMediaEntry();
mediaEntry.name = "Uploaded Media";
mediaEntry.mediaType = KalturaMediaType.VIDEO;
KalturaMediaService mediaService = kalturaClient.getMediaService();
mediaService.setKalturaClient(kalturaClient);
mediaEntry = mediaService.add(mediaEntry);
} catch (Exception e) {
e.printStackTrace();
}
}
}
ks=MTg1ZjU2OGJjMDk3YzQwY2QxYzYxYzBmNWQ1ZDE1MzE1NTNhNjExYnwyMjg1OTExOzIyODU5MTE7MTQ5NTgyNzA0ODsyOzI5MDg3O2ZyYW5rLmdhcmJlckBlc3BuLmNvbTs=
DEBUG | service url: [http://www.kaltura.com/]
DEBUG | JSON: [{"apiVersion":"3.3.0","ks":"MTg1ZjU2OGJjMDk3YzQwY2QxYzYxYzBmNWQ1ZDE1MzE1NTNhNjExYnwyMjg1OTExOzIyODU5MTE7MTQ5NTgyNzA0ODsyOzI5MDg3O2ZyYW5rLmdhcmJlckBlc3BuLmNvbTs=","entry":{"name":"Uploaded Media","objectType":"KalturaMediaEntry","mediaType":1},"clientTag":"java:17-03-01","format":2,"ignoreNull":true,"kalsig":"4944e44f16038ee6663462aa41c4c232"}]
DEBUG | Header [Accept value [text/xml,application/xml,*/*]
DEBUG | Header [Accept-Charset value [utf-8,ISO-8859-1;q=0.7,*;q=0.5]
DEBUG | Header [Accept-Encoding value [gzip]
DEBUG | Header [User-Agent value [Jakarta Commons-HttpClient/3.1]
DEBUG | Header [Host value [www.kaltura.com]
DEBUG | Header [Content-Length value [344]
DEBUG | Header [Content-Type value [application/json]
DEBUG | Using gzip compression to handle response for: POST //api_v3/service/media/action/add?null
DEBUG | Server: [ny-front-api37], Session: [1304826129]
DEBUG | <?xml version="1.0" encoding="utf-8"?>KalturaAPIExceptionINVALID_KS
Invalid KS "MTg1ZjU2OGJjMDk3YzQwY2QxYzYxYzBmNWQ1ZDE1MzE1NTNhNjExYnwyMjg1OTExOzIyODU5MTE7MTQ5NTgyNzA0ODsyOzI5MDg3O2ZyYW5rLmdhcmJlckBlc3BuLmNvbTs=", Error "-1,INVALID_STR"KalturaApiExceptionArgKSIDMTg1ZjU2OGJjMDk3YzQwY2QxYzYxYzBmNWQ1ZDE1MzE1NTNhNjExYnwyMjg1OTExOzIyODU5MTE7MTQ5NTgyNzA0ODsyOzI5MDg3O2ZyYW5rLmdhcmJlckBlc3BuLmNvbTs=KalturaApiExceptionArgERR_CODE-1KalturaApiExceptionArgERR_DESCINVALID_STR0.0025830268859863
com.kaltura.client.KalturaApiException: Invalid KS "MTg1ZjU2OGJjMDk3YzQwY2QxYzYxYzBmNWQ1ZDE1MzE1NTNhNjExYnwyMjg1OTExOzIyODU5MTE7MTQ5NTgyNzA0ODsyOzI5MDg3O2ZyYW5rLmdhcmJlckBlc3BuLmNvbTs=", Error "-1,INVALID_STR"
at com.kaltura.client.KalturaClientBase.getExceptionOnAPIError(KalturaClientBase.java:627)
at com.kaltura.client.KalturaClientBase.throwExceptionOnAPIError(KalturaClientBase.java:631)
at com.kaltura.client.KalturaClientBase.doQueue(KalturaClientBase.java:281)
at com.kaltura.client.services.KalturaMediaService.add(KalturaMediaService.java:66)
at MediaInfo.main(MediaInfo.java:27)
Is there something I need to do to the KS before it’s usable? Like decode it, or decompress it?
Thanks in advance for your help,
F