1

I am using google analytics api for C# v3 and I am trying to upload csv file for custom data set. But I am getting error that baseUri is missing. When I debug code under service object there is baseUri, and on internet I found some answers for this which points to wrong data set id I test that and it is not working. Also in all examples they use p12 file for service account and they have Management.DailyUploads property under service object, but I do not have that and even on web api explorer there is no DailyUploads. Other thing is that I am using json file for service account and I test some other api calls and they are working fine. So is there some bug with this google api call?

this is what I am doing

        GoogleCredential credential;
        using (var stream = new FileStream(HttpContext.Current.Server.MapPath("~/App_Data/AppKeyFile.json"), FileMode.Open, FileAccess.Read))
        {
            credential = GoogleCredential.FromStream(stream).CreateScoped(AnalyticsService.Scope.Analytics);
        }

        var service = new AnalyticsService(new BaseClientService.Initializer
        {
            HttpClientInitializer = credential,
            ApplicationName = "[APP_NAME]"
        });

        var uploadStream = new FileStream(@"[FILE_PATH]", FileMode.Open, FileAccess.Read);

        var request = service.Management.Uploads.UploadData("[AccountId]", "[WEB_PROPERTY_ID]", "[DATA_SET_ID]", uploadStream, "resumable");

        var result = await request.UploadAsync();
Skondiloza
  • 21
  • 1
  • 5
  • Have you contacted the API team? Many times they have a mail group or something like that. – Berin Loritsch Apr 18 '16 at 14:12
  • well i posted question on google group too and on some google analytics forum. – Skondiloza Apr 18 '16 at 14:43
  • Ok I found my error when I was looking on documentation what should I put as last parameter I switched content type for uploadType. So instead that "resumable" it should be "application/octet-stream" and then it is working. – Skondiloza Apr 18 '16 at 15:17

0 Answers0