我想获取ServiceNow中处于“等待呼叫者反馈状态”的所有事件的列表。现在我们的服务已启用Okta。
能否让我们知道如何访问已启用Okta的Servicenow API。
答案 0 :(得分:1)
默认情况下,ServiceNow REST Api使用基本身份验证。这与用于登录用户的身份验证方法不同。您应该可以使用default example拨打电话,而不必担心Okta。这是他们的Python示例:
#Need to install requests package for python
import requests
# Set the request parameters
url = 'https://instance.service-now.com/api/now/table/problem?sysparm_limit=1'
# Eg. User name="username", Password="password" for this code sample.
user = 'username'
pwd = 'password'
# Set proper headers
headers = {"Accept":"application/xml"}
# Do the HTTP request
response = requests.get(url, auth=(user, pwd), headers=headers)
# Check for HTTP codes other than 200
if response.status_code != 200:
print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:', response.content)
exit()
# Decode the XML response into a dictionary and use the data
print(response.content)