Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

An API Client for Alteryx Gallery in R

michael_treadwell
ACE Emeritus
ACE Emeritus

For those of you R users, I have been working on an API Client for Alteryx Gallery written in R. It is mostly working the way I intend but I need to do a little bit more testing before I release it to CRAN.

 

You can find it here: https://github.com/mtreadwell/alterryx

Until I have it released on CRAN, you can install it using devtools::install_github("mtreadwell/alterryx")

 

If anyone is an R user and also set up with a private Alteryx Gallery, I would be interested in feedback.

 

The package, alterryx (double r), provides access to each of the Alteryx Gallery API endpoints. With alterryx users can:

  • Retrieve information on Alteryx Gallery resources like apps, workflows, and macros

  • Queue jobs for applications

  • Retrieve the status and output of jobs

It is pretty handy to be able to schedule jobs and retrieve the results as a data.frame directly into R.

 

Feedback appreciated!

16 REPLIES 16
michael_treadwell
ACE Emeritus
ACE Emeritus

Which version of Alteryx Server are you running?

sarav1981_wa
6 - Meteoroid

Alteryx Version: 11.7.4.37815

michael_treadwell
ACE Emeritus
ACE Emeritus

In version 2018.1, Alteryx made changes to the underlying API response from the endpoint that returns information on an Alteryx jobs. Due to these changes, I had to update my package accordingly. This had the unfortunate consequence of breaking the package for users on any Alteryx Server version prior to 2018.1.

 

 

I want you to be able to understand why this is happening, so I will offer a more in-depth explanation:

 

Let's say we need to hit the endpoint that returns information on a job: /v1/jobs/{jobid}/

 

Before Alteryx 2018.1, the endpoint would return the following: 

 

{ "id": "", "createDate": "Date", "status": "", "disposition": "", "outputs": {}, "messages": {} }

Before converting this into an object of class "alteryx_job", my package needs to check this response to make sure it "looks" like the response for an Alteryx job. One of the checks is to look at the parameters that were returned and see if they match what is expected.

 

In Alteryx 2018.1, the endpoint began returning this instead:

 

{ "id": "", "appId": "", "createDate": "Date", "status": "", "disposition": "", "outputs": {}, "messages": {} }

Note the mysterious appearance of the "appID" parameter in the response that wasn't present before. Because of this, my package was failing. As a result, I had to add this parameter to the list of expected parameters. This broke the package for anyone not on version 2018.1 or later.

 

could maintain two separate versions of this package for separate versions of Alteryx Server, but unfortunately I also have a job and that would require a significant amount of work. If you are interested in creating a custom version of the package you could easily clone my repo on github, delete a single line of code, and rebuild the package for yourself. It will work fine. I will even show you the line you need to delete.

sarav1981_wa
6 - Meteoroid

Thank you for the detailed explanation. The R package is a great addition to my toolkit, and hope to extensively use with when we upgrade our Alteryx version.

neeleshapatil1
8 - Asteroid

@michael_treadwell 

 

I tried to install alterryx package but came across following errors. Can you please confirm what could be an issue?

 

Is there any specific steps to follow to install this package? Sorry but I am not familiar with R so want to know if any specific steps required.

 

package ‘sys’ successfully unpacked and MD5 sums checked
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 16384 != reported length 64375
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'askpass/DESCRIPTION', probable reason 'No such file or directory'

michael_treadwell
ACE Emeritus
ACE Emeritus

Usually these errors appear because of permissions / firewall issues.

 

Are you trying to install behind a corporate firewall? If so, make sure you have access to CRAN.

Do you have permissions to write and install to local drives? Try running R/R Studio as an admin.

neeleshapatil1
8 - Asteroid

thanks @michael_treadwell for your quick reply.

I don't have permissions running R/R Studio as an admin. Is there any way if only particular script can be used for the purpose of migration api?