Copyright © 2008 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.
famfamfam
I'm writing unit tests for the new API V3 Java client. I'm making a call to the mediaService.update() method and I'm a little confused. The method takes an entry ID and a KalturaMediaEntry as the argument. So I assumed what I needed to do was create a new KalturaMediaEntry object with the values I want to update and then pass that to the method along with the original entry's entry id.
So, suppose I want to update the tags. I set the tags property to the new set of tags, then I call update.
The problem is, my Java client generator creates initial values for some of the properties of KalturaMediaEntry (this seems reasonable and is how the dot net client works). So my "update" object contains the value I want to change (tags) as well as values that I'm not really changing (props that were initialized when the object was constructed). When the update method sees those, it complains that they are "non-updateable" properties. Fine, I thought, I'll change the generator to not initialize those props. So now I have a KalturaMediaEntry that has null for everything but the tags property. When I pass that to update, the server gives me a: "PROPERTY_VALIDATION_CANNOT_BE_NULL The property "KalturaMediaEntry::mediaType" cannot be NULL" error.
At this point, I'm dammed if I do, dammed if I don't on update. I can't set a property for a non-updateable field, and I can't NOT set a property for a field that can't be null.
Maybe I'm misinterpreting how I'm supposed to call that service. Does anyone know how a call to KalturaMediaService.update is supposed to work?
Jeff
I do it that way on php
$client->media->update($id, $k);
After that code I have updated name and description of the entry with id=$id. Other fields of entry have saved there values that were before update.
Anyway, it may be something wrong with initializing KalturaMediaEntry in java client library?
If you don't initialize those properties, the server will complain that they are null. Interesting that PHP doesn't have that problem. Maybe I need to adjust the client to not send the properties at all if they are null.
I'd be curious to hear from anyone using the dot net API as I essentially ported that to Java. Based on what I saw in the dot net client generator, I expect it to have the same problem.
Jeff
It looks like with the PHP library, if the value is null it doesn't pass this on to the server.
Hi Jeff,
Only the updatebale fields should be send to the server.
In the .NET client, if the value is null it will not be added to the request.
(For integers Int32.MinValue is checked as null, and booleans are defined as nullable bool ("bool?"))
BTW,
The following error sounds strange when trying to update with invalid params:
"PROPERTY_VALIDATION_CANNOT_BE_NULL The property "KalturaMediaEntry::mediaType" cannot be NULL" error.
Are you sure that you receive it on update?
Roman
BTW, I also tried using the existing KalturaMediaEntry as the thing I pass to update (with a changed tags property) and that approach doesn't work either. I don't think the server is being smart about what properties are to be changed. Here's the error that comes back:
PROPERTY_VALIDATION_NOT_UPDATABLE The property "KalturaMediaEntry::id" cannot be updatedTrust me, I'm not trying to change the entry ID, Kaltura.
This may require a dive into the source on the server-side.
Jeff