Hi,
Does DOMO offer API to embed Dashboard? Is there any API like below?
https://api.domo.com/v1/dashboards/{dashboardId}/embed
I could not find any details about this API in documentation. So, if this API exists can you please share the URL of Documentation?
GPT suggested below code to switch dataset and load Dashboard with Dataset Switching. Can you please confirm if this is possible?
public async Task<string> GetEmbedUrl(string accessToken, string dashboardId, string datasetId)
{
using var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"https://api.domo.com/v1/dashboards/{dashboardId}/embed");
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
var payload = new { datasetId = datasetId }; // Pass dynamic dataset ID
request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(payload), Encoding.UTF8, "application/json");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
var json = Newtonsoft.Json.Linq.JObject.Parse(result);
return json["url"].ToString(); // Embedded URL
}