function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andrew MagruderAndrew Magruder 

Wave Analytics dataset upload via SOAP API calls from C# sends error

The error message is:  "The dataflow failed to run because you did not specify the data parts in the InsightsExternalDataPart object. : Metadata JSON"

I'm using my org's Enterprise WSDL as a Web Reference (not a Service Reference).

This is my C# code (Visual Studio 2012 set to use Dot Net Framework 4.6.1) that prepares my CSV for upload and puts it into a series of InsightsExternalDataPart's.

            byte[] CSV_Contents_BLOB = File.ReadAllBytes(CSV_FileName);
            string CSV_Contents_Base64_STR = Convert.ToBase64String(CSV_Contents_BLOB);
            byte[] CSV_Contents_Base64_BLOB = System.Text.Encoding.Default.GetBytes(CSV_Contents_Base64_STR);
             File.WriteAllBytes(CSV_BASE64_FileName, CSV_Contents_Base64_BLOB);  

I run some code that creates a GZIP file out of the file whose name is contained in the variable CSV_BASE64_FileName.

I chunk the GZIP file into a series of .BIN files all 9 MB or less in size.  The parentID below shows in the debugger as a typical 18 char SalesForce ID.

I upload the data parts:

            int PartCounter = 1;
            string rowID = "";
            foreach (string MyFileName in Chunked_FileNames)
            {
                InsightsExternalDataPart ChunkPart = new InsightsExternalDataPart();
                Byte[] Partial_CSV_Content_BLOB = File.ReadAllBytes(MyFileName);
                ChunkPart.DataFile = Partial_CSV_Content_BLOB;
                ChunkPart.InsightsExternalDataId = parentID;
                ChunkPart.PartNumber = PartCounter;
                SaveResult[] resultsPART = SfdcBinding.create(new sObject[] { WaveDS_Cr });
                foreach (SaveResult sv in resultsPART)
                    if (sv.success)
                        rowID = sv.id;
                    else
                    {
                        string ErrMsg = "'Add the Data' failed. OK will close the program. Message: " + sv.errors[0].message;
                        MessageBox.Show(ErrMsg);
                        this.Close();
                    }
                PartCounter++;
            }

The code above runs with success.  sv.id in the above is a typical SaleForce ID.

Now I Process the upload:

            //*************************************************************************
            //*                                                                       *
            //*                   "Manage the Upload" title in the PDF                *
            //*                   Now send the chunks to Wave.                        *
            //*                                                                       *
            //*************************************************************************

            WebRef_Enterprise.InsightsExternalData WaveDS_Up = new WebRef_Enterprise.InsightsExternalData();
            WaveDS_Up.Action = "Process";
            WaveDS_Up.Id = parentID;
            SaveResult[] resultsMng = SfdcBinding.update(new sObject[] { WaveDS_Up });
            foreach (SaveResult sv in resultsMng)
                if (sv.success)
                    rowID = sv.id;
                else
                {
                    string ErrMsg = "'Manage the Upload' failed. Click OK to close the program. Message: " + sv.errors[0].message;
                    MessageBox.Show(ErrMsg);
                    this.Close();
                }

In the above code, sv.errors[0].message equals:  "The dataflow failed to run because you did not specify the data parts in the InsightsExternalDataPart object. : Metadata JSON"

I've tried this with and without Base 64 encoding. I've verified the Base 64 encoding at the binary level.

What is the problem?