I recently downloaded the new Server API Tool 2023.1 but when I try and run the tool, I receive an error "The test "Error retrieving authorization token" failed: ExpectedNumRecords==0,NumRecords(#1)==1." Hoping someone has insight as to how to remedy this.
I have followed the instructions here: Server API Tool | Alteryx Help
As you can see in the workflow below, I'm simply testing the tool and don't have any other components to the workflow.
Has anyone found a solution? I am having similar issues.
The only thing I can think of is that if you are querying this from within the server, you may need to do localhost, instead of the URL. I have found some interesting things happening in the swagger documentation when this is the case.
Jarrod at Alteryx reached out and helped me with a workaround. If I'm understanding correctly, the issue comes from cert verify errors if they aren't updated frequently. It sounds like they are working on creating a fix in the tool's next release.
In the meantime, he had me make a few minor adjustments to the python script. I've included the steps below, but I'm not a python expert, so I can't guarantee it will work for you. If you make the changes and it doesn't work, I'd recommend undoing them before continuing your troubleshooting.
Steps to bypass the error:
1. Open the MACRO for the Server API Tool
2. In the "Authenticate" section, select the Python Tool.
3. Select "Interactive" in the configuration window.
4. Scroll down to the section In[3]: and comment out (put a hashtag) before the second line
#os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
5. In Section In [3]: On the third line under "try", add verify=False
token = oauth.fetch_token(token_url=baseUrl+'/oauth2/token', client_id=client_id, client_secret=client_secret, verify=False)
6. In the configuration window, just above the code, hit the save button.
7. Scroll down and to the right in the canvas window to find the Python tool in the API Calls, Logging, and Output container
8. Select "Interactive" in the configuration window.
9. Scroll down to the section In [3]: and update the response row under def ayxServerAPI... to include "verify=False"
response = requests.request(method, url, headers=hed, data=payload, files=files, stream=stream, verify=False)
10. In the configuration window, just above the code, hit the save button.
User | Count |
---|---|
19 | |
15 | |
15 | |
8 | |
6 |