Flavorupload not uplaoding to the remote storage

Hi when I am reuplaoding a flavor video, I am able to upload through the kaltura admin panel console and it is getting stored in the remote storage but from the api it is not getting stored to the remote storage.


Please provide your code.

Hi when I am uploading through the kaltura console in flavors and in actions at that time the video is going to the remote storage but not when I am using the code below:
package com.kaltura.code.example;

import com.kaltura.client.enums.;
import com.kaltura.client.types.
import com.kaltura.client.services.*;
import com.kaltura.client.KalturaApiException;
import com.kaltura.client.KalturaClient;
import com.kaltura.client.KalturaConfiguration;

import com.kaltura.client.types.KalturaUploadedFileResource;

class CodeExample{

public static void main(String[] args){


KalturaConfiguration config = new KalturaConfiguration();
KalturaClient client = new KalturaClient(config);

String id = null;

KalturaUploadedFileResource contentResource = new KalturaUploadedFileResource();

Object result = client.getFlavorassetService().setContent(id, contentResource);

}catch(KalturaApiException e){





Hi there,

Your code seems incomplete… it doesn’t actually upload a file. Can u pls paste the full code?
Or pls review the steps here and compare to your code - https://developer.kaltura.com/workflows/Ingest_and_Upload_Media/Uploading_Media_Files

Hi Jess ,
I am re-uploading a file in that flavor assetId

but it is not uploading it.

Hi @himanshu_bhatt, is your problem when using your code or with KMC upload? If it’s related to your code, please review the above guiding message - your code doesn’t actually upload the file. Please review the reference workflow here; https://developer.kaltura.com/workflows/Ingest_and_Upload_Media/Uploading_Media_Files

Hi @ZoharBabin it is related to the code. Can we re-upload a file like in the above photo? In going to the flavors and then in actions in the selection tab then upload for a particular asset id in the code. As in the documentation, it is uploading and creating the new entryId for the video.

Ah, now I understand your question :slight_smile:
Yes, KMC is simply a front-end application that calls the API too. You can just open a network sniffer and see all the API requests it makes when you perform this upload.
To upload a file into a flavor, simply use the setContent action on the specific flavorAsst after calling flavorAsst.add to create one.

Hi @ZoharBabin,
So it should be what kind of resource I am uploading a file and then it should go to my remote storage, So it should be KalturaUploadedFile resource?

The resource you’re ingesting doesn’t relate to Remote Storage… Remote Storage is a backend configuration, and you can configure it to happen automatically regardless of what resource type was ingested.
If you’re uploading a file , you need need to make sure you’re actually uploading it… in your code above you didn’t upload anything.

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.kaltura.client.enums.;
import com.kaltura.client.types.
import com.kaltura.client.services.*;
import com.kaltura.client.APIOkRequestsExecutor;
import com.kaltura.client.Client;
import com.kaltura.client.Configuration;
import com.kaltura.client.services.FlavorAssetService;
import com.kaltura.client.services.FlavorAssetService.SetContentFlavorAssetBuilder;
import com.kaltura.client.types.ListResponse;
import com.kaltura.client.utils.response.OnCompletion;
import com.kaltura.client.utils.response.base.Response;

class MigrateKaltura {
public static void main(String[] args) {
Client client = MigrateKaltura.generateKalturaClient();

    String id = "0_pve9zhli";
   //ContentResource contentResource =null; /* KalturaContentResource is an abstract class, please select an implementation */;
   File file=new File("/home/abc.mp4");
    UploadedFileResource uploadedFileResource=new UploadedFileResource();
    SetContentFlavorAssetBuilder requestBuilder = FlavorAssetService.setContent(id, contentResource)
            .setCompletion(new OnCompletion<Response<FlavorAsset>>() {
                public void onComplete(Response<FlavorAsset> result) {


public static Client generateKalturaClient() {
    Configuration config = new Configuration();
    Client client = new Client(config);
    try {
        String session = client.generateSessionV2(
                86400, "");
    } catch (Exception e) {
        System.out.println("Failed to start Kaltura session");
    return client;


@ZoharBabin in java sdk I am using kalturaApiClient veresion 15.16.0. But in that library, there is no UploadedFileResource class and I am not able set the contentResource. In the api docs it shows UploadedFileResource but I am not able to find that class in the library

Hello @himanshu_bhatt,

You should first create an uploadToken like so:

                UploadToken uploadToken = new UploadToken();

                AddUploadTokenBuilder requestBuilder = UploadTokenService.add(uploadToken);

// perform the file upload
                String file = "/path/to/fileName;
                FileInputStream fileData = new FileInputStream(file);
                boolean resume = false;
                boolean finalChunk = true;
                int resumeAt = -1; // this is in the event you do not need chunked uploading, if the source video is bigger than 2G, you will need to chunk it into smaller segments and upload each of these; parallel uploading is supported - see https://github.com/kaltura/kaltura-chunked-upload-test/blob/parallel-upload/chunkedupload/ParallelUpload.java and https://github.com/kaltura/kaltura-parallel-upload-resumablejs as reference

                UploadUploadTokenBuilder requestBuilder = UploadTokenService.upload(uploadToken, fil

And then use KalturaUploadedFileTokenResource when calling FlavorAssetService.setContent() like so:

String tokend = "";
UploadedFileTokenResource contentResource = new UploadedFileTokenResource();

SetContentFlavorAssetBuilder requestBuilder = FlavorAssetService.setContent(id, contentResource)
    .setCompletion(new OnCompletion<Response<FlavorAsset>>() {
        public void onComplete(Response<FlavorAsset> result) {

Hi @jess I tried this code and ran but it is not storing in remote storage it is storing locally in kaltura.

Hello @himanshu_bhatt,

Review your storage_profile and delivery_profile records for the partner in question.
You can do that via Admin Console->Publishers->YOUR PARTNER->Profiles->Remote Storage and Admin Console->Publishers->YOUR PARTNER->Profiles->Delivery Profile or by querying the DB directly.

If everything looks in order , you should go to Admin Console->Batch Process Control->Entry Investigation and check the status of the export job. You should then proceed to review the logs for the batch worker to understand where the failure occurs.

Hi @jess when I am uploading through console then it is going to the remote storage.

Hi @jess @ZoharBabin the storage export job is not working when I am uplaoding it through code


As I wrote previously:

If the job failed, you need to understand why that is, if the storage export job wasn’t created, compare it with what happens when you do it from KMC to understand what’s different.

As was also mentioned before, you can use a HTTP sniffer when taking actions in KMCng in order to understand what API requests these actions trigger (since KMCng uses the JS API client). You can use the browser’s dev tools for that.