思科ISE API POST(500错误)

时间:2018-07-12 22:54:17

标签: api

我很难使用他们的API在Cisco ISE中创建新的端点。这是我的代码:

import json
import requests
from requests.auth import HTTPBasicAuth

# LAB Endpoint
API_ENDPOINT ="myurl.com:9060/ers/config/endpoint"
data= {
  "ERSEndPoint" : {
  "name": "name",
  "description": "description",
  "mac" : "99:99:99:99:99:99",
  "profileId" : "profileId",
  "staticProfileAssignment" : "false",
  "groupId" : "groupId",
  "staticGroupAssignment" : "false",
  "portalUser" : "portalUser",
  "identityStore" : "identityStore",
  "identityStoreId" : "identityStoreId",
  "customAttributes" : {
    "customAttributes" : {
      "key1" : "value1",
      "key2" : "value2"
      }
    }
  }
}
headers = {'Content-Type': 'application/json',
           'Accept': 'application/json'}
r = requests.post(url = API_ENDPOINT, data = json.dumps(data), headers=headers, auth=('user', 'pwd'))
print r.text

我一直收到500错误。

> {   "ERSResponse" : {
>     "operation" : "POST-create-endpoint",
>     "messages" : [ {
>       "title" : "CREATE: DB internal error during CRUD operation Unable to create the endpoint. ORA-02291: integrity constraint
> (CEPM.REF_ROLE_MASTER) violated - parent key not found\n",
>       "type" : "ERROR",
>       "code" : "CRUD operation exception"
>     } ],
>     "link" : {
>       "rel" : "related",
>       "href" : "https://ezlrtvise22.msstore.microsoftstore.com:9060/ers/config/endpoint",
>       "type" : "application/xml"
>     }   } }

它似乎不断抛出一些奇怪的Oracle DB密钥错误。有什么建议么?我也尝试使用REST Firefox扩展程序进行测试,但仍然收到相同的错误。谢谢!

1 个答案:

答案 0 :(得分:0)

groupId和profileID的值必须是要放入此设备的组/配置文件的各自的uuid。(或者您可以完全省略profileID密钥,因为它不是必需的。)

请参阅https://example.com:9060/ers/config/endpointgroup列出所有端点组(及其UUID)。