0

我想获取 ServiceNow 中处于“等待呼叫者反馈状态”的所有事件的列表。我们的 servicenow 已启用 Okta。

请告诉我们如何访问启用 Okta 的 Servicenow API。

4

1 回答 1

1

ServiceNow REST Api 默认使用基本身份验证。这与用于登录用户的身份验证方法是分开的。您应该能够使用默认示例拨打电话,而不必担心 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)
于 2019-07-16T03:20:11.017 回答