C# API SDK sends all the params via the single multipart-form item named "json"

Hello,

I’m trying to upload the video to the https://www.kaltura.com/ server via C#.
I have downloaded the C# SDK but I have faced the issue: all params are converted to the json and passed as the single multipart-form item named “json”.

Error I’m receiving is MISSING_MANDATORY_PARAMETER “Missing parameter “uploadTokenId””. I have unwrapped the params and passed them one by one as a standalone multipart-form item and it works.

So I have a question - is there a real availability to pass all the params as a single multipart-form item called “json” or it’s obsolete feature and C# SDK was not updated?

@jess could you please help?

Thank you!

Hello,

Not quite sure I understand… please share your code so we can further look into it.
Also, here is an example of using the C# client lib for uploading an asset:
https://github.com/kaltura/KalturaGeneratedAPIClientsCsharp/blob/master/KalturaClientTester/KalturaClientTester.cs#L341

This test does more than you actually need since after uploading a video, it also gets a specific transcoding flavor, replaces it, and uploads a caption file.

I suggest you try using the same code for the upload process, the rest of the test is irrelevant for your initial need.

I’m trying to call SampleThreadedChunkUpload();
It raises the error out of the box.

I am unaware of such a method in our API nor do I see it in any of the samples under the csharp client lib.
Please provide a full code sample.

https://github.com/kaltura/KalturaGeneratedAPIClientsCsharp/blob/master/KalturaClientTester/KalturaClientTester.cs#L60

OK, I see. I was looking at an earlier version of the client.
Anyhow, please attach a full code sample, as well as the output you’re getting.
It would also be helpful to run the units for this client and see if that works correctly.
Note that for the units to run, you need to edit KalturaClientTester/KalturaClientTester.cs and set your own partner ID and admin_secret.

I have unzipped the SDK again to make sure that there are no changes.

First change I have made - I have moved the line 60 to the line 57 to call it immediately after run but with no args:
https://github.com/kaltura/KalturaGeneratedAPIClientsCsharp/blob/master/KalturaClientTester/KalturaClientTester.cs#L60

Then I had to comment out the line 144 because of the following Exception:The access to service [uploadToken->add] is forbidden
https://github.com/kaltura/KalturaGeneratedAPIClientsCsharp/blob/master/KalturaClientTester/KalturaClientTester.cs#L144

Now you can run the project and see the Exception: Missing parameter “uploadTokenId”.
This is because of the merging params in a single multipart-form item. You can debug it here:
https://github.com/kaltura/KalturaGeneratedAPIClientsCsharp/blob/master/KalturaClient/KalturaClientBase.cs#L464

Other words the request contains two params: fileData and json. The last one contains all the params serialized to json format. But the response says that it wants to see the separate uploadTokenId parameter.

Hi,

Let’s start by editing KalturaClientTester/KalturaClientTester.cs, setting your partner info like I said and running the unit tests to make sure they all pass.
We do that nightly as part of our CI and it works correctly, as you can see here:
https://travis-ci.org/kaltura/KalturaGeneratedAPIClientsCsharp

Once that works for you, you can create the minimal code snippet that uploads based on the code in the units and if that does not work for you, paste the full code sample so I can help you debug it.

Hi,

Unfortunately I can;t find the unit tests. I have downloaded the solution with two projects inside: Client and ClientTester.
img src="/uploads/default/original/2X/2/2c5f17b423e9392510f266d525dfa657cb02f647.png" width=“286” height=“500”>

I have configured the params, like I did before:
img src="/uploads/default/original/2X/b/b3159c3537847b01d993d86365a1ccd823e62196.png" width=“690” height=“278”>

And hit F5:


Could you please try to do the same?
My version is “csharp_22-06-2016.tar.gz”

This system doesn’t allow me to attach more than 1 image. So please open them yourself.
BTW, the same problem I had in previous post with GitHub links. But I was able to save the post with 1 url and then edit it and add 2 more. It seems that system doesn’t check URLs during editing