Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

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

Has anyone ever used the GET /admin/v1/auditlog/ API option?

Thableaus
17 - Castor
17 - Castor

Hi everyone,

 

I've been playing around with the API calls available in the Gallery, and I was wondering how this one would work.

 

When I try to use it, I get an Internal Server Error. Other calls don't generate this error.

I'm assuming there are some parameters required like "entity", "page" and "pageSize" but how would they be chained in the URL? They don't explain that in the documentation.

 

Thableaus_0-1590063981207.png

 

 

Has anyone used this one succesfully?


Thanks,

7 REPLIES 7
JohnPelletier
Alteryx Alumni (Retired)

Hi @Thableaus,

 

It's working for me, but our versions are likely different.

 

What version are you running?

 

What values are you passing it for entity, page and pageSize?

 

 

 

DataSandwich
5 - Atom

I am also having this issue.  @JohnPelletier could you provide a dummy workflow showing how you configured the auditlog call?  I can get the other endpoints to work but this one is evading me.

JohnPelletier
Alteryx Alumni (Retired)

@DataSandwich  

JohnPell_0-1590684377589.png

/gallery/api/admin/v1/auditlog/?entity=AppInfo&page=1&pageSize=10&oauth_timestamp=1590684343&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=<insertkeyhere>&oauth_version=1.0&oauth_nonce=vmQ8k&oauth_signature=<insertsignaturehere>

What are you putting for required query parameters? Entity should be "AppInfo", "Collection", "Credential", "Subscription", or "User"

PageSize needs to be > 0

Page needs to be >= 0

DataSandwich
5 - Atom

Thanks @JohnPelletier .

 

So more context would be that I can get the auditlog endpoint working in the interactive documentation, but I hit the issue when I try to access it via one of my workflows. Note I can access the other endpoints from the workflow so I know it's not an issue with the flow itself. Seems like I am missing something small in terms of how I construct the signature base string and send the entity/page/pageSize query parameters through the url.

 

Here's some reference info that may help. Really appreciate any guidance you can provide here.

 

Endpoint works in interactive documentation:

DataSandwich_0-1590688711478.png

 

And here are values for the key fields behind the API call in the workflow (replaced sensitive info with placeholders)

ColumnValue
Endpoint URLhttps://gallery.myserver/gallery/api/admin/v1/auditlog/
Signature Base String (used to create signature)GET&https%3A%2F%2Fgallery.myserver%2Fgallery%2Fapi%2Fadmin%2Fv1%2Fauditlog%2F&oauth_consumer_key%3DMYKEY%26oauth_nonce%3D000002%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1590688353%26oauth_version%3D1.0
Full_Request_URL (url sent via download tool)https://gallery.myserver/gallery/api/admin/v1/auditlog/?entity=AppInfo&page=1&pageSize=10&oauth_cons...
DownloadData that comes back with 401{"data":null,"exceptionName":"UnauthorizedException","innerExceptionMessage":"","message":"The provided signature(oauth_signature) is invalid."}

 

Finally here are screenshots of the download tool configs:

BasicHeaders
DataSandwich_1-1590689119553.png

 

DataSandwich_2-1590689128950.png

 

PayloadConnection
DataSandwich_3-1590689136886.png

 

DataSandwich_4-1590689145664.png

 

 

TashaA
Alteryx Alumni (Retired)

Hey @DataSandwich , 

 

Looking at the configuration of the Download Tool that you have. Have you tried modifying the header to be called Content-Type? Specifically with the dash in between.

 

-Tasha

DataSandwich
5 - Atom

Thanks @TashaA!

 

It looks like either will work.  I finally worked my way through this one and the missing link seemed to be the way the oauth_signature is prepared.  You have to include entity, page, and pageSize as query parameters in the signature base that gets encrypted into the oauth_signature.  On top of that you have to make sure all the query parameters are sorted alphabetically before bringing them into the signature base string.  Finally you also have to make sure you include these 3 parameters in your request URL, with them coming immediately after the ? character.

 

I threw together an example that illustrates how to get it working.  You'll have to update the relevant fields in the formula tool at the beginning (within the yellow container).

 

Hope this proves helpful to others!

JohnPelletier
Alteryx Alumni (Retired)

@DATA I've been hunting for a good sample for you, but I'm glad to hear you got it working. 

Thanks, @TashaA !