Invoking TabPy API with Postman

TabPy server provides REST API which can be used outside of Tableau (e.g. for debugging purposes), more detail about it can be found here:

At the moment TabPy only supports API v1, but new versions with added or different functionality are possible in the future.

Additionally, read Using Python in Tableau Calculations for how parameters and data are passed to TabPy.

You can call the API from the command line using curl or similar tool, e.g.:

c:\Users\TabPyUser>curl -X POST http://my-tabpy-server:9004/evaluate -d "{\"data\":{\"_arg1\":[1, 2, 3],\"_arg2\":[3, -1, 5]},\"script\":\"return [x + y for x, y in zip(_arg1, _arg2)]\"}"
[4, 1, 8]

But as you can see it is a lot of typing, hard to read and impossible to see if anything is wrong in the address, headers, request body and so on.

Postman is the tool created just for the purpose of invoking REST API. And TabPy has Postman file in the repository with all the supported methods.

Install Postman, download https://github.com/tableau/TabPy/blob/master/misc/TabPy.postman_collection.json file in it and you have UI ready for making TabPy calls:

After loading the file open TabPy collection and click on a method you want to exercise. Replace {{endpoint}} variable with your TabPy server name and port or define the variable to reuse it and click Send button.

Note some methods are GET and some are POST – for POST methods you can specify request body as shown on the screenshot above.

If your TabPy is configured for secure connection simply use https:// instead of http:// in the URL.

In case TabPy is configured with authentication (read how to configure TabPy authentication at https://github.com/tableau/TabPy/blob/master/docs/server-config.md#authentication) use Auth tab for request as shown at screenshot below.

Note TabPy only supports Basic Auth method at the moment as specified on TabPy Authentication page.

5 1 vote
Article Rating
Share the post if you liked it
  •  
  •  
  •  
  •  
  •  
  •  
Oleksandr Golovatyi

Author: Oleksandr Golovatyi

Member of Tableau Advanced Analytics team and a contributor to TabPy and this blog.

Subscribe
Notify of
guest
1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
trackback

[…] Invoking TabPy API with Postman. […]