Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

adding more info to the API reference page#183

Merged
graysonarts merged 18 commits intotableau:developmenttableau/server-client-python:developmentfrom
d45:masterd45/server-client-python:masterCopy head branch name to clipboard
Apr 26, 2017
Merged

adding more info to the API reference page#183
graysonarts merged 18 commits intotableau:developmenttableau/server-client-python:developmentfrom
d45:masterd45/server-client-python:masterCopy head branch name to clipboard

Conversation

@d45
Copy link
Contributor

@d45 d45 commented Apr 19, 2017

This PR is to add more information about the TSC library API methods and classes. You can preview the updated docs here: https://d45.github.io/server-client-python/docs/api-ref

The PR also includes an update to the navigation pane (docs_menu.html) for the new sections. Looks like there is a minor merge conflict with that file (spaces or something).

NOTE: Merging into master so that the update goes live when the PR is approved.
I could also merge into the Dev branch, if you prefer. That would require another move to get the files to master. Squash and merge if it seems OK after review. Thanks.

@d45
Copy link
Contributor Author

d45 commented Apr 19, 2017

OK. I spoke too soon. The api-ref.md file has some conflicts. The new version should replace the old.

Copy link
Contributor

@graysonarts graysonarts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest question is around ordering of the api reference. I feel like there is an inherent hierarchy in the design of the library and listing the api reference in alphabetic order doesn't feel like the right thing to me.

If I was reading this documentation, I would want the first thing first: the server object. Then auth since you have to sign in before every thing else. Maybe if it was broken into to sections: "Top-level" and "Resources" or something like that?

@@ -5,257 +5,3008 @@ layout: docs

<div class="alert alert-info">
<b>Important:</b> More coming soon! This section is under active construction and might not reflect all the available functionality of the TSC library.
Until this reference is completed, we have noted the source files in the TSC library where you can get more information for individual endpoints.
</div>
<!--- Until this reference is completed, we have noted the source files in the TSC library where you can get more information for individual endpoints. --->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just delete the comment. We have version control if we need to revive this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take care of the quick fixes in this PR (against master). I hear you about the ordering of the API references. I will look into that after I switch to development as base.

The TSC API reference is organized by resource. The TSC library is modeled after the REST API. The methods, for example, `workbooks.get()`, correspond to the endpoints for resources, such as [workbooks](#workbooks), [users](#users), [views](#views), and [data sources](#data-sources). The model classes (for example, the [WorkbookItem class](#workbookitem-class) have attributes that represent the fields (`name`, `id`, `owner_id`) that are in the REST API request and response packages, or payloads.

|:--- |
| **Note:** Some methods and features provided in the REST API might not be currently available in the TSC library. In addition, the same limitations apply to the TSC library that apply to the REST API with respect to resources on Tableau Server and Tableau Online. For more information, see the [Tableau Server REST API Reference](http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_ref.htm#API_Reference%3FTocPath%3DAPI%2520Reference%7C_____0){:target="_blank"}.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add "and vice-versa" because we have functionality in TSC that isn't released to the public yet (though they are in betas)


* TOC
{:toc }
<!-- {:toc ::options toc_levels="1,2"} -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the comments. Leftover from an experiment with kramdown and the toc_levels in the toc macro.

```
The `TableauAuth` class contains the attributes for the authentication resources. The `TableauAuth` class defines the information you can set in a request or query from Tableau Server. The class members correspond to the attributes of a server request or response payload. To use this class, create a new instance, supplying user name, password, and site information if necessary, and pass the request object to the [Auth.sign_in](#auth.sign-in) method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably include a note about other authentication schemes may be added in the future (e.g. oauth)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

:--- | :---
`username` | The name of the user whose credentials will be used to sign in.
`password` | The password of the user.
`site_id` | This corresponds to the `contentUrl` attribute in the Tableau REST API. The `site_id` is the portion of the URL that follows the `/site/` in the URL. For example, "MarketingTeam" is the `site_id` in the following URL *MyServer*/#/site/**MarketingTeam**/projects. To specify the default site on Tableau Server, you can use an empty string **' '**. For Tableau Online, you must provide a value for the `site_id`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your empty string contains a space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll correct that and spell it out.

Name | Description
:--- | :---
`datasource_id` | The identifier (`id`) for the the `DatasourceItem` that you want to download from the server.
`filepath` | (Optional) Downloads the file to the location you specify. If no location is specified (the default is `Filepath=None`), the file is downloaded to the current working directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention no_extract as a parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it. I'll add no_extract to workbooks.download too

@d45 d45 changed the base branch from master to development April 20, 2017 21:26
`datasource_id` | The identifier (`id`) for the the `DatasourceItem` that you want to download from the server.
`filepath` | (Optional) Downloads the file to the location you specify. If no location is specified (the default is `Filepath=None`), the file is downloaded to the current working directory.

`no_extract` | (Optional) Specifies whether to download the file without the extract. When the data source has an extract, if you set the parameter `no_extract=True`, the extract is not included. You can use this parameter to improve performance if you are downloading data sources that have large extracts. The default is to include the extract, if present (`no_extract=False`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should mention that this is REST v2.5+.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We should probably add the "available in REST version XX" for all of these. Or some.

Copy link
Contributor

@graysonarts graysonarts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that one small change about no_extract, looks good.

Copy link
Collaborator

@t8y8 t8y8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through half and had some comments.

Overall pretty solid, lots of nit picks on my part. I'll review the second half soonish (sorry it took me so long)


## Authentication

Source files: server/endpoint/auth_endpoint.py, models/tableau_auth.py
You can use the TSC library to manage authentication, so you can sign in and sign out of Tableau Server and Tableau Online. The authentication resources for Tableau Server are defined in the `TableauAuth` class and they correspond to the authentication attributes you can access using the Tableau Server REST API.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't manage authentication, you sign in out sign out -- I could misread this to think it let's me manipulate other credentials on Server or auth settings or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. It took me a while to get back on this. I just made another commit and added the update_connections for workbooks. That is what caused the merge conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Good point. I managed to remove the managed and simplified it.

```
The `TableauAuth` class contains the attributes for the authentication resources. The `TableauAuth` class defines the information you can set in a request or query from Tableau Server. The class members correspond to the attributes of a server request or response payload. To use this class, create a new instance, supplying user name, password, and site information if necessary, and pass the request object to the [Auth.sign_in](#auth.sign-in) method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little skeptical calling it an authentication 'resource'. Not a big one, I'd actually just call it an object or credentials or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I wasn't sure about that either. My wording here is pretty clumsy. I'll revise. Gotta run right now, but I will get back to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cut it down to this:
The TableauAuth class defines the information you can set in a sign-in request. The class members correspond to the attributes of a server request or response payload. To use this class, create a new instance, supplying user name, password, and site information if necessary, and pass the request object to the Auth.sign_in method.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful

self.server.sites.create(new_site)
import tableauserverclient as TSC

# create a auth request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an auth

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

# create an instance for your server
server = TSC.Server('http://SERVER_URL')

# call the sign-in method with the request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You call sign in with the object/resource/whatever-you-pick not the request, you're making a request


### Get Sites
The method takes care of invalidating the authentiction token. For more information, see [Sign in and Out](sign-in-out).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method? or the method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "The sigh_out() method ... "

...

project_id = '3a8b6148-493c-11e6-a621-6f3499394a39'
file_path = 'C:\\temp\\WorldIndicators.tde'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer raw strings r'C:\temp\WorldIndicators.tde' -- style choice though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go with that. Thanks.

...

single_datasource = TSC.DatasourceItem('test', '1d0304cd-3796-429f-b815-7258370b9b74')
# need to specify the ID - this is a workaround.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like workaround in the docs :( why is this necessary? /cc @RussTheAerialist

That is, what's this sample showing, do we need to demonstrate it that way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not sure what you are trying to show here? In this case, that workaround was probably specifically to enable the test scenario and not a preferred way of doing something

Copy link
Contributor

@graysonarts graysonarts Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, if I look below. In this case, we want to "get the datasource by id" from the server object before updating it. The current implementation in this section is definitely not what we want people to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes. Good catch. That is a placeholder example from the test code.

Copy link
Contributor Author

@d45 d45 Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced that example with this:

# get the data source item to update
  datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
  
# do some updating 
  datasource.name = 'New Name'

# call the update method with the data source item
  updated_datasource = server.datasources.update(datasource)

```

### Get Views for a Workbook
The `GroupItem` class contains the members or attributes for the view resources on Tableau Server. The `GroupItem` class defines the information you can request or query from Tableau Server. The class members correspond to the attributes of a server request or response payload.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are members?
I think it's just attributes :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. Fixed that. Also changed "view resources" to "group resources" - copy and paste error.

# The id for Ian is '59a8a7b6-be3a-4d2d-1e9e-08a7b6b5b4ba'

# add Ian to the second group
server.groups.add_user(all_groups[1], '59a8a7b6-be3a-4d2d-1e9e-08a7b6b5b4ba')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever possible we should avoid the [subscript] notation in example because it's not obvious what it means. We can always pop it from the list and give it a name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I was just trying to get something to work and stopped at that. I will update these instances if I can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rats! -- I goofed on some of these examples. We don't have a groups.get_by_id() method.
Probably thinking of it as way to get around indexing []. I guess I didn't test those.

# call the create method
newgroup = server.groups.create(newgroup)

# print the names of the groups on the server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without Pager this is only the first 100 groups

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the 100 limit to the comment

@t8y8
Copy link
Collaborator

t8y8 commented Apr 21, 2017

Text is looking great, only thing I have left (before maybe a final pass) is that I agree w/ @RussTheAerialist that the organization is a bit odd. Filter/Sort inside the list alphabetically is very is jointed from their actual use.

@d45
Copy link
Contributor Author

d45 commented Apr 21, 2017 via email

@graysonarts graysonarts merged commit 27b5917 into tableau:development Apr 26, 2017
graysonarts pushed a commit that referenced this pull request Apr 26, 2017
* adding to ref pages; saving progress so far

* Check in to save progress-o

* Another chekin' for the cause

* Check in more stuff; added api buckets in docs menu

* Updated with users, groups; snapshot

* Check in more changes to ref pages, minor fix for docs menu

* more updates; formatting fixes, etc.

* um updates, workbooks in prog, etc.

* getting there, mostly done.

* sorted, added filters, requests, etc.

* ready for review....

* update to the left nav for new classes

* Added sites.get_by_name; added quotes to sever.version number example

* updates from tech review; added no_extract to downloads (workbook, data sources)

* Added workbooks.update_connections (the cause of merge conflict); fixed some connectionitem info

* tech review fixes, removed groups.get_by_id from examples, fixed datasource update example

* Ran spellcheck, fixed misc errors
t8y8 pushed a commit to t8y8/server-client-python that referenced this pull request Jun 28, 2017
* adding to ref pages; saving progress so far

* Check in to save progress-o

* Another chekin' for the cause

* Check in more stuff; added api buckets in docs menu

* Updated with users, groups; snapshot

* Check in more changes to ref pages, minor fix for docs menu

* more updates; formatting fixes, etc.

* um updates, workbooks in prog, etc.

* getting there, mostly done.

* sorted, added filters, requests, etc.

* ready for review....

* update to the left nav for new classes

* Added sites.get_by_name; added quotes to sever.version number example

* updates from tech review; added no_extract to downloads (workbook, data sources)

* Added workbooks.update_connections (the cause of merge conflict); fixed some connectionitem info

* tech review fixes, removed groups.get_by_id from examples, fixed datasource update example

* Ran spellcheck, fixed misc errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.