Hi everyone,
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:
#package library
library(httr)
library(jsonlite)
library(urltools)
# 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,
"?oauth_timestamp=", as.character(signature[5]),
"&oauth_signature_method=", signature[4],
"&oauth_consumer_key=", signature[1],
"&oauth_version=", signature[6],
"&oauth_nonce=", signature[2],
"&oauth_signature=", url_encode(unlist((signature[3])))
)
#Send request to server and print response
request <- GET(oauth)
print(request)This code produces the following request string (which gets the HTTP 401 invalid oauth signature error):
"https://<org instance>.com/gallery/api/v1/workflows/subscription/?oauth_timestamp=1617041856&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=<apikey>&oauth_version=1.0&oauth_nonce=qsAXwrreNa&oauth_signature=FIuHrQMsS%2br74zfV7x9lXCCmjiI%3d"
Here is the string that successfully calls the server API created with the help docs:
https://<org instance>.com/gallery/api/v1/workflows/subscription/?oauth_timestamp=1617041913&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=<apikey>&oauth_version=1.0&oauth_nonce=zay7u&oauth_signature=QgzEtGdTphIm12EVVum5rOiL9LY%3D
As you can see these are set up identically, besides for the custom nonce, timestamp, and signature that my code is creating.
Any assistance or guidance would be greatly appreciated. Have read other community posts on the topic which were helpful, (namely https://community.alteryx.com/t5/Alteryx-Server-Discussions/How-to-Run-a-Job-Using-Alteryx-Server-API-and-Python/td-p/312363) but after encorporating their suggestions something is still missing and I'm out of troubleshooting ideas.
Thanks!
Bobby