Jump to content

API Explorer GUI


Recommended Posts

Andrew Lawrence
This post was recognized by Andrew Lawrence!

"Thanks for sharing this with the community Peter, its great to see tools like this and we really hope it helps other on this forum. Amazing stuff!"

PeterH was awarded the badge 'Great Content' and 50 points.

I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:

>>> user = session.query('User').first()
>>> print(user.keys())  # Look for a key related to groups
>>> print(user['memberships'])  # Perhaps this, check if entity or list
>>> print(user['memberships'][0].keys())  # It's a list, check what each item has available
>>> print(user['memberships'][0]['group'].keys())  # I see group, what keys does that have
>>> print(user['memberships'][0]['group']['name'])  # Found what I needed (random example though, I've never actually needed this)
>>> user_groups = [membership['group']['name'] for membership in user['memberships']]


I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...