community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

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

An API Client for Alteryx Gallery in R

Alteryx Certified Partner
Alteryx Certified Partner

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!

Meteoroid

I am having trouble getting the API authentication to work. Receive a 401 error response, which I believe refers to "provided signature (oauth_signature) is invalid".

 

What is the option to provide oauth credentials using the library.

 

> library(alterryx)
> 
> alteryx_api_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> alteryx_secret_key <- "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
> alteryx_gallery <- "http://mygalleryaddress/gallery/api"
> 
> options(alteryx_api_key = alteryx_api_key)
> options(alteryx_secret_key = alteryx_secret_key)
> options(alteryx_gallery = alteryx_gallery)
> 
> subscription <- get_app()
Error in check_status(response) : 401 Unexpected Response

Thank you!

Alteryx Certified Partner
Alteryx Certified Partner

Generally, if the signature is invalid, it explicitly states it in the error message.

 

Try this:

 

alteryx_gallery <- "http://mygalleryaddress/gallery"

 

Instead of this:

 

alteryx_gallery <- "http://mygalleryaddress/gallery/api"

 

Meteoroid

Thank you, Michael for the tweak. I did realize it after checking the API endpoints.

 

With the change, I explicitly receive the signature invalid error.

 

Is there a need to provide parameters to generate the oauth nonce, timestamp and signatures dynamically? 

 

> library(alterryx)
> 
> alteryx_api_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> alteryx_secret_key <- "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
> alteryx_gallery <- "http://mygalleryaddress/gallery/"
> 
> options(alteryx_api_key = alteryx_api_key)
> options(alteryx_secret_key = alteryx_secret_key)
> options(alteryx_gallery = alteryx_gallery)
> 
> # request_params <- list(oauth_signature_method="HMAC-SHA1",oauth_version="1.0")
> # 
> # subscription <- get_app(request_params)
> subscription <- get_app()
Error in check_status(response) : 
  401 UnauthorizedException The provided signature(oauth_signature) is invalid.
Alteryx Certified Partner
Alteryx Certified Partner

Sorry. There is a known issue in my package that I haven't had time to fix yet. Remove the "/" from the end of your gallery URL.

 

 

Try this:

alteryx_gallery <- "http://mygalleryaddress/gallery"

 

Instead of this:

alteryx_gallery <- "http://mygalleryaddress/gallery/"
Alteryx Certified Partner
Alteryx Certified Partner

Can't say thank you enough for using my package and finding issues. I went ahead and opened an issue on the Github page so that it will be fixed in the next release.

https://github.com/mtreadwell/alterryx/issues/6

Meteoroid

Thank you, Michael. Looking forward to your package updates.

 

Currently, I execute and receive job status updates on Alteryx gallery runs using a tweak on the C# API client that Alteryx provides. Would be really helpful to integrate the package to my R process, once the fixes are in.

 

> library(alterryx)
> 
> alteryx_api_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> alteryx_secret_key <- "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
> alteryx_gallery <- "http://mygalleryaddress/gallery"
> 
> options(alteryx_api_key = alteryx_api_key)
> options(alteryx_secret_key = alteryx_secret_key)
> options(alteryx_gallery = alteryx_gallery)
> 
> # request_params <- list(oauth_signature_method="HMAC-SHA1",oauth_version="1.0")
> # subscription <- get_app(request_params)
> subscription <- get_app()
> subscription[1]
[[1]]
App Name: Test.yxmd
App ID: 5b1ffdd6529ad717d4c04b40
Alteryx Certified Partner
Alteryx Certified Partner

You shouldn't need to wait on the fix to have the package run properly.

When you remove the "/" at the end of your Gallery URL and run the code below, you are still getting an error?

 

library(alterryx)

alteryx_api_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
alteryx_secret_key <- "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
alteryx_gallery <- "http://mygalleryaddress/gallery"

options(alteryx_api_key = alteryx_api_key)
options(alteryx_secret_key = alteryx_secret_key)
options(alteryx_gallery = alteryx_gallery)
subscription <- get_app()

Would you mind restarting your R environment, running the code above, and if still doesn't work sending me the printout of:

 

sessionInfo()

 

Also, what version of Alteryx Server are you currently running?

 

Additionally, as a note, I see that in the commented-out section you are entering oauth signature method and version. None of that is necessary, it is all handled by the package.

Meteoroid

The package runs great. I pasted an error snippet by mistake.

 

Our Alteryx server is running on version 11.7.4.37815.

 

Thank you for the quick response.

 

> library(alterryx)
> 
> alteryx_api_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> alteryx_secret_key <- "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
> alteryx_gallery <- "http://mygalleryaddress/gallery"
> 
> options(alteryx_api_key = alteryx_api_key)
> options(alteryx_secret_key = alteryx_secret_key)
> options(alteryx_gallery = alteryx_gallery)
> 
> subscription <- get_app()
> subscription[1]
[[1]]
App Name: Test.yxmd
App ID: 5b1ffdd6529ad717d4c04b40

 

 

Meteoroid

 

Receiving a weird error attempting to source the gallery job executions for a given app, using get_app_jobs() function.

 

Obtain a 'cannot convert to alteryx_job' input error.

 

> library(alterryx)
> 
> alteryx_api_key <- "xxxxxxxxxxxxxx"
> alteryx_secret_key <- "yyyyyyyyyyyy"
> alteryx_gallery <- "http://mygalleryaddress/gallery"
> 
> options(alteryx_api_key = alteryx_api_key)
> options(alteryx_secret_key = alteryx_secret_key)
> options(alteryx_gallery = alteryx_gallery)
> 
> # Get Gallery Alteryx Apps; Filter for the required for further analysis
> gallery_apps <- get_app()
> req_app <- gallery_apps[[9]]
> req_app
App Name: Test.yxwz
App ID: 5b50d1bb529ad72b0cd378b7 
> 
> # Obtain all gallery job runs for the filtered app
> req_app_jobs <- get_app_jobs(req_app)
Error in as.alteryx_job(content, app) : 
  Unexpected input. Cannot convert to type alteryx_job.
> req_app_jobs
Error: object 'req_app_jobs' not found
> req_app_jobs2 <- get_app_jobs(gallery_apps[[9]])
Error in as.alteryx_job(content, app) : 
  Unexpected input. Cannot convert to type alteryx_job.
> req_app_jobs2
Error: object 'req_app_jobs2' not found