PSYNOW Python module - How to search sys_user table when sys_id is known
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 07:17 PM
Hello All:
I'm using the python module PYSNOW and I need some assistance trying to search the sys_user table when I know the sys_id. Can someone provide an example using the query builder?
Here is what I have tried to use....
sys_user= c.resource(api_path='/table/sys_user')
userData=sys_user.get(query={'sys_id':'837482ea827383748273'}) [FAKE sys_id of course]
I'm not even sure type kind of class userData would become. I'm not a programmer and more of a python hack. Just write stuff to get something done.
If someone could provide a sample of how to retrieve this data that would be great. I'm basically trying to get the users full name from the table.
Thanks
GlenC
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2018 11:36 AM
import pysnow
# Create client object
c = pysnow.Client(instance='myinstance', user='myusername', password='mypassword')
# Define a resource, here we'll use the usertable table API
incident = c.resource(api_path='/table/sys_user')
# Query for incident with number username
response = incident.get(query={'user_name': 'enter username.sysid'})
# Print out the matching record
print(response.one())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2018 11:38 AM
I actually didn't know about the pysnow module until i saw your post. this is interesting . thanks 🙂