public async Task <EmbedParams> Get(string id)
        {
            powerBI.Value.ReportId = id;

            // Validate whether all the required configurations are provided in appsettings.json
            string configValidationResult = ConfigValidatorService.ValidateConfig(azureAd, powerBI);

            if (configValidationResult != null)
            {
                throw new ArgumentException();
            }

            EmbedParams embedParams = await pbiEmbedService.GetEmbedParams(new Guid(powerBI.Value.WorkspaceId), new Guid(powerBI.Value.ReportId));

            return(embedParams);
        }
Пример #2
0
        public string GetEmbedInfo()
        {
            try
            {
                // Validate whether all the required configurations are provided in appsettings.json
                string configValidationResult = ConfigValidatorService.ValidateConfig(azureAd, powerBI);
                if (configValidationResult != null)
                {
                    HttpContext.Response.StatusCode = 400;
                    return(configValidationResult);
                }

                EmbedParams embedParams = pbiEmbedService.GetEmbedParams(new Guid(powerBI.Value.WorkspaceId), new Guid(powerBI.Value.ReportId));
                return(JsonSerializer.Serialize <EmbedParams>(embedParams));
            }
            catch (Exception ex)
            {
                HttpContext.Response.StatusCode = 500;
                return(ex.Message + "\n\n" + ex.StackTrace);
            }
        }