📌 Developers & APIs | Resources
Ciara Brennan (Tableau)
📌 Join the Tableau Developer Program and start learning how you can build on the Tableau Developer Platform to fit your organization's unique needs. You'll get everything you need to keep your skills sharp, including tutorials, webinars, the latest news, and even your own personal development site. You will also get access to thousands of DataDevs members for networking, troubleshooting, Q&As, and expert insights.
Amber Crowe (Member) asked a question.
We are using the Embedded API to display Tableau dashboards in a web portal. Our row level security is based on the username mapped to a customer ID in an entitlement table, so the user can only see their personal data.
For On-Demand Access (ODA), it looks like we don't have to provision users on our Tableau Server. Rather, access will be controlled on the web portal side, and the web portal can send user attributes to Tableau via the token.
With ODA are we still able to use our entitlement tables for RLS? Will it be secure? It's critical that our customers can not see other user's data.
Right now, our plan is:
For testing, we have my personal email hardcoded in the token under the "sub" as we needed a provisioned user to test the connection to our Tableau site. Can that be removed once everything is set up?
Jayesh Patil (Member) asked a question.
I having written python script to automate that uses "Tableau server client" api that applies values to a filter, convert it to pdf and then download it. This is the automation I am working on.
I have a filter called "Summary" it has values : [Null, alpha, beta, delta] in dropdown options. It can accepts multiple values at once for eg. Summary =[alpha, beta] can be selected all at once.
The default value is [alpha, beta]. I wanna include [Null, alpha, beta, delta] as values.
I cant set value as Null. Is there any way to set value as Null or exclude delta?
Ankit Gada (Member) asked a question.
Tableau Extensions: I want to download entire image (or pdf image version of the entire worksheet) of the worksheet present in the dashboard within the Tableau Extension. Could you please suggest if I'm using the right Tableau API function?
Below is the javascript code that I have added for an onclick button event but it is not giving any outcome or saving it on desktop on click of the button:
// Function to generate and download image of the worksheet
function downloadWorksheetImage() {
worksheet.getImageAsync().then(function (image) {
let link = document.createElement("a");
link.href = image;
link.download = worksheet.name + ".png";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}).catch(function (error) {
console.error("Error downloading image:", error);
console.error("Error details:", error.name, error.message, error.stack); //Log the error details
});
}
// Function to generate and download PDF of the worksheet
function downloadWorksheetPDF() {
worksheet.getImageAsync().then(function (image) {
const { jsPDF } = window.jspdf;
const pdf = new jsPDF();
pdf.addImage(image, 'PNG', 10, 10, 180, 160);
pdf.save(worksheet.name + ".pdf");
}).catch(function (error) {
console.error("Error downloading PDF:", error);
console.error("Error details:", error.name, error.message, error.stack); // Log the error details
});
}
Jian Du (Member) asked a question.
Dear All,
I am a licensed user on the Tableau Server of my company, and I am the site Admin of one the sites.
I need to pull out the full list of all the schedules registered on the server.
I tried graphQL but failed.
I searched through the following page about graphQL RootTypeQuery, it seems that Schedule is not among the fields available for search. Does this mean there is no way to retrieve the schedule list via graphQL?
https://help.tableau.com/current/api/metadata_api/en-us/reference/query.doc.html
Best Regards,
Jian
Bradley Service (Member) asked a question.
We are embedding a view in our application and need to programmatically change what filters are applied to the report before it loads on the page. I have been able to accomplish this using <viz-filter field="some" value="thing" /> for all filters except the date range filters. We've tried changing the filters to different styles (a Range of Dates slider filter and trying two Start Date -> End Date filters) and neither are effected by the values passed in on the viz-filter. Ideally, we should have it set up so that you can pass the viz an end date and it will change the start date relative to that value so that you're always looking at the same span of time (e.g. 4 weeks, 2 months, etc.).
I've checked for grammatical errors. I've tried downloading the tableau-api from npm and initializing the viz in a different way. The only method that I haven't tried successfully has been inserting the appyFiltersAsync() method because the documentation doesn't show you how to import tableau into a React Component, and I am unable to access it from the window property.
Any help would be greatly appreciated,
Thanks
Qasim Ali (Member) asked a question.
I've set up a dummy project with a server using node.js:
const express = require("express");
const jwt = require("jsonwebtoken");
const cors = require("cors");
require("dotenv").config();
const { v4: uuidv4 } = require('uuid');
const app = express();
app.use(cors());
app.use(express.json());
const secretValue = process.env.PRIVATE_KEY;
const clientId = process.env.CLIENT_ID;
const secretId = process.env.ISSUER;
const username = process.env.USERNAME;
const tokenExpiryInMinutes = 1;
const scopes = [
"tableau:views:embed",
"tableau:views:embed_authoring",
"tableau:insights:embed",
];
const kid = secretId;
const iss = clientId;
const sub = username;
const aud = "tableau";
const exp = Math.floor(Date.now() / 1000) + (tokenExpiryInMinutes * 60);
const jti = uuidv4();
const scp = scopes;
app.post("/generate-token", (req, res) => {
const payload = {
iss,
exp,
jti,
aud,
sub,
scp,
};
console.log(payload);
console.log(secretValue);
const token = jwt.sign(payload, secretValue, {
algorithm: "HS256",
header: {
kid,
iss,
},
});
console.log(token);
res.json({ token });
});
app.listen(5000, () => console.log("Server running on port 5000"));
And the frontend using React:
import React, { useEffect, useState } from "react";
function TableauEmbed() {
const [token, setToken] = useState(null);
const fetchToken = async () => {
try {
const response = await fetch("http://localhost:5000/generate-token", {
method: "POST",
headers: { "Content-Type": "application/json" },
cache: "no-store",
});
const data = await response.json();
setToken(data.token);
} catch (err) {
console.error("Error fetching token:", err);
}
};
useEffect(() => {
fetchToken();
}, []);
return (
<div>
<h1>Tableau Embedded Dashboard</h1>
{token ? (
<tableau-viz
id="tableauViz"
width="1000"
height="1000"
hide-tabs={false}
touch-optimize={false}
disable-url-actions={false}
debug={false}
src="LINK_HIDDEN"
device="Desktop"
toolbar="bottom"
token={token}
>
</tableau-viz>
) : (
<p>Loading...</p>
)}
</div>
);
}
export default TableauEmbed;
It runs fine when I start the server, but as soon as I access the link via an incognito browser, I get one of two errors:
The same also occurs when I reload the page on just one instance after a while has passed.
What is the problem here?
Yasmeen Wilde (Member) asked a question.
Here is our use case: Users publish snowflake data source with oauth authentication method and then site admin will edit the published data source on the server to change the authentication method from oauth to username/password using a service account. Site admin will have to download the data source to desktop, change authentication method and then republish. This causes inconvenience to our self-service creators because they will have to rely on site admins to publish their data sources. All published data sources must use service account credential due to our compliance standards.
Please check out our post with some tips on asking a question and how to help you get answers more quickly.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.