Repository navigation
fix: build the Share embed snippet for a view - #1933
ranjithguggilla wants to merge 2 commits into
Conversation
The REST API does not return the embed HTML from the Share button. views.embed_code builds it from the view URL: the Embedding API v3 component on REST API 3.13 and later, and the JavaScript API object embed on older servers.
|
Thanks for this, @ranjithguggilla. One version-gate problem, plus a few questions. Needs fixing: version gate ( The PR body says REST 3.13 is Tableau 2021.4. The REST API versions table maps 3.13 to 2021.3 and 3.14 to 2021.4, and the Embedding API docs say the v3 library is hosted on Tableau Server from 2021.4. On a 2021.3 server this builds a snippet whose script URL doesn't exist. Could you gate at 3.14 and correct the PR body? A boundary test at 3.13 and 3.14 would cover it. Questions
Drafted with AI assistance (Claude); reviewed and posted by Jac. |
The version table maps 3.13 to Tableau 2021.3 and 3.14 to 2021.4, and the v3 embed library is hosted from 2021.4. A 3.13 server now gets the older snippet. The docstring lists the fixed toolbar settings and the errors, and the tests cover those errors and names that contain & or '.
|
Addressed in 575aacf. The v3 snippet now starts at REST API 3.14. The version table maps 3.13 to Tableau 2021.3 and 3.14 to 2021.4, and the Embedding API v3 library is hosted from 2021.4. The docstring now has Parameters, Returns, and Raises (
|
Closes #996
Motivation
There is no REST method that returns the embed HTML from a view's Share button. The snippet is built from the view URL. Jac Fitzgerald noted that adding it would be useful. The issue is labeled
ui-existsbecause the UI has the snippet and the REST API does not.Behavior change
views.embed_code(view)returns that HTML for the signed-in site.tableau-vizelement andtableau.embedding.3.latest.min.js.viz_v1.js.A named site uses
/t/{site}/views/{workbook}/{view}. The default site uses/views/{workbook}/{view}.toolbar="bottom"andhide-tabsare fixed, and the older snippet usestabs=noandtoolbar=yes. Neither snippet sets a width or height. Callers edit the returned HTML to change those.Test plan
Tests cover the legacy snippet, the 3.13/3.14 boundary, the v3 snippet on the default site and on a named site,
NotSignedInError, bothMissingRequiredFieldErrorpaths, and a site and workbook name containing&or'.Not covered: pasting the snippet into a browser against a Tableau site.