Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to get only one object in sys_user?

Vyacheslav
Kilo Explorer

Hi! 
I want to create parser using VBA and API ServiceNow. For example, I can get all data from sys_user -
https://sninstance.example.ru/api/now/table/sys_user

My result is :

{
"calendar_integration": "1",
"country": "",
"last_login_time": "",
"u_e_mail_financial": "ff@f.com",
"source": "",
"sys_updated_on": "2018-10-24 12:48:31",
"building": "",
"web_service_access_only": "false",
"notification": "2",
"enable_multifactor_authn": "false",
"sys_updated_by": "fff",
"sys_created_on": "2018-09-13 13:29:51",
"sys_domain": {
"link": "sninstance.example.ru/api/now/table/sys_user_group/global",
"value": "global"
},
"state": "",
"vip": "false",
"sys_created_by": "test",
"zip": "",
"home_phone": "",
"time_format": "",
"last_login": "",
"active": "false",
"sys_domain_path": "/",
"u_address_for_sending_documents": "",
"cost_center": "",
"phone": "",
"name": "Ffff ff",
"employee_number": "",
"password_needs_reset": "false",
"gender": "",
"city": "",
"failed_attempts": "",
"user_name": "ff@ff.com",
"title": "",
"sys_class_name": "sys_user",
"sys_id": "000018d9f9e863008ff068a048a5d115",
"u_additional_company": "",
"internal_integration_user": "false",
"ldap_server": "",
"mobile_phone": "",
"street": "",
"company": {
"link": "sninstance.example.ru/api/now/table/core_company/151f9aacf96063008ff068a048a5d1c5",
"value": "151f9aacf96063008ff068a048a5d1c5"
},
"department": "",
"first_name": "Fff",
"email": "fff.ff@ff.com",
"introduction": "",
"preferred_language": "en",
"manager": "",
"u_current_duty": "false",
"locked_out": "true",
"sys_mod_count": "2",
"last_name": "Massa",
"photo": "",
"u_comment": "",
"middle_name": "",
"sys_tags": "",
"time_zone": "",
"schedule": "",
"u_import_id": "704",
"u_email_signature": "",
"u_available": "",
"date_format": "",
"location": ""
},
 

But this records are too much and I don't want to get all data from this sys_user.
I want to get only one user. I want to search by user's email. But I don't know how to do this.

If user is not find, I will get error. If user exist, I will get his data in JSON (check up). How to create this requset. For example  - 

https://ff-ff.ff-ff.ru/api/now/table/sys_user/searchByEmail:email@email.com

5 REPLIES 5

Hi,

You can do it like this

https://your-instance.service-now.com/api/now/table/sys_user?sysparm_query=email%3Dabel.tuter%40example.com&sysparm_limit=1

This will search by email and limit the results to 1

 

Mark answer as correct/helpful if this helps you.