Im trying to get a single video using C#. Im using the following code but Im just getting 'EntryId Not found" errors
KalturaClient client = new KalturaClient(GetConfig());
client.SessionService.Start(AppSettings.AdminSecret, "", KalturaSessionType.ADMIN, AppSettings.PartnerId, 86400, "");
var test = client.MediaService.Get(videoId);
The ID is correct as its taken straight from Kaltura?
public static class SearchManager
{
public static KalturaClient CreateClient()
{
KalturaClient client = new KalturaClient(GetConfig());
client.StartMultiRequest();
client.SessionService.Start(AppSettings.AdminSecret, "", KalturaSessionType.ADMIN, AppSettings.PartnerId, 86400, "");
client.KS = "{1:result}";
// for the current multi request, the result of the first call will be used as the ks for next calls
return client;
}
private static KalturaConfiguration GetConfig()
{
var config = new KalturaConfiguration(AppSettings.PartnerId)
{
ServiceUrl = AppSettings.ServiceUrl
};
return config;
}
public static KalturaMediaListResponse Search(string searchText)
{
//Create the connection
KalturaClient client = CreateClient();
//Add any search filters
KalturaMediaEntryFilter filter = AddFilters(searchText);
//Set the data paging
CreatePaging(client, filter);
KalturaMultiResponse response = client.DoMultiRequest();
// in multi request, when there is an error, an exception is NOT thrown, so we should check manually
if (response[1].GetType() == typeof(KalturaAPIException))
{
// we can throw the exception if we want
throw (KalturaAPIException)response[1];
}
return (KalturaMediaListResponse)response[1];
}
public static KalturaMediaEntry GetVideo(string videoId)
{
//Create the connection
KalturaClient client = new KalturaClient(GetConfig());
client.StartMultiRequest();
client.SessionService.Start(AppSettings.AdminSecret, "", KalturaSessionType.ADMIN, AppSettings.PartnerId, 86400);
var test = client.MediaService.Get(videoId);
return test;
}
private static void CreatePaging(KalturaClient client, KalturaMediaEntryFilter filter)
{
var pager = new KalturaFilterPager { PageSize = AppSettings.PageSize };
client.MediaService.List(filter, pager);
}
private static KalturaMediaEntryFilter AddFilters(string searchText)
{
KalturaMediaEntryFilter filter = new KalturaMediaEntryFilter
{
OrderBy = KalturaMediaEntryOrderBy.CREATED_AT_DESC
};
if (!String.IsNullOrEmpty(searchText))
{
filter.SearchTextMatchOr = searchText;
}
return filter;
}
That is what the code was in the C# Api example. Im finding the documentation to be very limited. I may be wrong (and please correct me if I am) but there is not any docs on just getting started retrieving a video, or doing simple searches etc. So all I have to go by is the example code.
However, the method Im having trouble with is the GetVideo method which doesn’t use the client.KS call.