This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I am working on creating a connection to Alteryx Gallery in R so we can dynamically kick off workflows. I am trying to start with a simple example by just doing a GET request to pull all app ID's in my private studio (using the "/v1/workflows/subscription/" endpoint), but cannot resolve the oauth signature HTTP 401 error. I have read all the API documentation, and have created a request string that is nearly identical to what is produced in the help docs, so I'm not sure where to turn next. Here is my code:
# Credential values obtained from user Profile on Alteryx Gallery
apikey <- <apikey>
secret <- <secret>
# Base url used for all api calls to gallery
Baseurl <- "https://<org instance>.com/gallery/api/"
# Endpoint for specific action query
get.subscriptions <- "v1/workflows/subscription/"
# Generate oauth signature
signature <- oauth_signature(url = Baseurl,
method = "GET",
oauth_app(appname = "Alteryx",
key = apikey,
secret = secret)
# Concatenate oauth parameters and append to base url and endpoint
oauth <- paste0(Baseurl, get.subscriptions,
#Send request to server and print response
request <- GET(oauth)
This code produces the following request string (which gets the HTTP 401 invalid oauth signature error):
2) I have a blog post about using alteryx to hit the alteryx api that provides a lot of api details. It looks like you're leveraging the httr library for the signature, so I'm not sure what it's doing wrong. You may want to create your own signature so that way you get it right. For the signature, you need to base64 encode a string like this using HMAC-SHA1. I would look at the digest library to do the HMAC-SHA1 part (and then you would just need to base64 encode it). Here is the input for the hashing of the oauth_signature:
1) Your secret will need to have an ampersand at end (&)
2) in looking at httr documentation, I think you'll need to add all of the oauth paramaters to the oauth_signature function. You'll definitely need to have them in alphabetical order, and the whole url encoding can be tricky (ie sometimes you need & and sometimes you need the url encoded &). I still think building your own signature with digest is your best bet as I'm not sure what all httr is doing under the hood.