Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
Andy Uttley, Alteryx ACE, makes music with Alteryx | Math + Music

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

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

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,

Highlighted
Alteryx
Alteryx

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?

 

 

 

Highlighted
5 - Atom

I am also having this issue.  @JohnPell 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.

Highlighted
Alteryx
Alteryx

@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

Highlighted
5 - Atom

Thanks @JohnPell .

 

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

 

 

Highlighted
Alteryx
Alteryx

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

Highlighted
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!

Highlighted
Alteryx
Alteryx

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

Thanks, @TashaA !