<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cisco ISE API - Sponsor portal account creation in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4760888#M579375</link>
    <description>&lt;P&gt;Hello Rodrigo,&lt;/P&gt;
&lt;DIV&gt;&lt;SPAN&gt;thanks&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;answering.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Both ports (443 or 9060) should work as expected:&lt;BR /&gt;&lt;A href="https://developer.cisco.com/docs/identity-services-engine/latest/#!cisco-ise-api-framework/cisco-ise-api-service" target="_blank" rel="noopener"&gt;https://developer.cisco.com/docs/identity-services-engine/latest/#!cisco-ise-api-framework/cisco-ise-api-service&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"ERS APIs are REST APIs that are based on the HTTPS protocol and operate over the standard HTTPS port 443 (port 9060 can also be used)."&lt;/DIV&gt;
&lt;P&gt;Anyway, also using port 9060 I still have the same error.&lt;BR /&gt;&lt;BR /&gt;The user is created but java returns a timeout error, it is something else.&lt;BR /&gt;&lt;BR /&gt;=================================== vvv UPDATE 1 vvv ===================================&lt;BR /&gt;I tested the same script on my old infrastructure (ISE 2.4) and everything is working as expected&lt;BR /&gt;On the new one (ISE 3.1), with the same request, I still receiving HTTP 500&lt;BR /&gt;=================================== ^^^ UPDATE 1 ^^^ ===================================&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2023 11:51:03 GMT</pubDate>
    <dc:creator>Riccardo Atzeni</dc:creator>
    <dc:date>2023-01-25T11:51:03Z</dc:date>
    <item>
      <title>Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4757017#M579299</link>
      <description>&lt;P&gt;Hello Everyone.&lt;BR /&gt;I'm working with ISE's API and I'm facing a strange error creating an account.&lt;BR /&gt;Basically, I'm using Python with the requests module to:&lt;BR /&gt;- obtain the sponsor portal ID (GET);&lt;BR /&gt;- obtain the sponsor ID (GET);&lt;BR /&gt;- create the guest user on the sponsor portal (POST);&lt;/P&gt;
&lt;P&gt;This is the Java error with HTTP status code 500:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
  "ERSResponse" : {
    "operation" : "POST-create-guestuser",
    "messages" : [ {
      "title" : "Creating GuestUser failed due to com.cisco.cpm.guestaccess.exception.GuestAccessSystemException: java.util.concurrent.TimeoutException",
      "type" : "ERROR",
      "code" : "CRUD operation exception"
    } ],
    "link" : {
      "rel" : "related",
      "href" : "https://&amp;lt;IPADDRESS&amp;gt;:&amp;lt;PORT&amp;gt;/ers/config/guestuser",
      "type" : "application/xml"
    }
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, the user is created on the ISE but I cannot be sure because I'm expecting an HTTP status code 201.&lt;BR /&gt;&lt;BR /&gt;Can someone help me, please?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 20:35:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4757017#M579299</guid>
      <dc:creator>Riccardo Atzeni</dc:creator>
      <dc:date>2023-01-18T20:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4757029#M579300</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;500&lt;/STRONG&gt;(Internal Server Error): Indicates an issue on the server side. Logs on ISE may help understand the cause.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As you mentioned 200 and 201 expected success and accounts created.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;check below example :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.cisco.com/c/en/us/support/docs/security/identity-services-engine/215476-configure-ise-guest-accounts-with-rest-a.html" target="_blank"&gt;https://www.cisco.com/c/en/us/support/docs/security/identity-services-engine/215476-configure-ise-guest-accounts-with-rest-a.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.cisco.com/t5/security-knowledge-base/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773" target="_blank"&gt;https://community.cisco.com/t5/security-knowledge-base/ise-guest-sponsor-api-tips-amp-tricks/ta-p/3636773&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 21:06:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4757029#M579300</guid>
      <dc:creator>balaji.bandi</dc:creator>
      <dc:date>2023-01-18T21:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4758599#M579325</link>
      <description>&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Hello BB,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;thanks &lt;/SPAN&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; answering.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;There aren&lt;/SPAN&gt;&lt;SPAN&gt;'t relevant logs on "Reports" --&amp;gt; "Sponsor Login and Audit" only authentications by the ERS user.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Anyway, the Guest User is created, what is wrong?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;This is the payload that I'&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;m using:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;LI-CODE lang="javascript"&gt;payload = {
	"GuestUser": {
		"guestType": "Weekly (default)",
		"personBeingVisited": "internal.usern@compa.ny",
		"portalId": sponsorPortalID,
		"sponsorUserName": usernameERS,
		"sponsorUserId": sponsorID,
		"guestInfo": {
			"enabled": True,
			"firstName": "GuestFirstName",
			"lastName": "GuestLastName",
			"emailAddress": "guest@gue.st",
			"company": "Guest Company",
			"phoneNumber": "+1234567890"
		},
		"guestAccessInfo": {
			"validDays": validDays,
			"location": location,
			"fromDate": fromDate,
			"toDate": toDate
		},
		"customFields": {},
		"link": {}
	}
}&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 20 Jan 2023 09:58:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4758599#M579325</guid>
      <dc:creator>Riccardo Atzeni</dc:creator>
      <dc:date>2023-01-20T09:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4758870#M579337</link>
      <description>&lt;P&gt;This is the python script that I made:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;#!/usr/bin/env python3

import base64, json, requests, urllib3
from datetime import datetime as dt, timedelta as td
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

ip   = "10.10.10.10"
port = "443"
usernameADM = "********"
passwordADM = "********"
usernameERS = "********"
passwordERS = "********"

authB64ADM = bytes.decode(base64.b64encode(str.encode(f"{usernameADM}:{passwordADM}")))
authB64ERS = bytes.decode(base64.b64encode(str.encode(f"{usernameERS}:{passwordERS}")))

uris = {
	"guestuser": "/ers/config/guestuser",
	"guestuserinfo": "/ers/config/guestuser/versioninfo",
	"sponsorportal": "/ers/config/sponsorportal",
	"sponsor": "/ers/config/internaluser"
}

def httpHeader(auth):
	headers = {
		"Content-Type": "application/json",
		"Accept": "application/json",
		"Authorization": f"Basic {auth}",
		"Cache-Control": "no-cache"
	}
	return headers

def getSponsorPortalId():
	url = f"https://{ip}:{port}{uris['sponsorportal']}"
	headers = httpHeader(authB64ADM)
	r = requests.get(url, headers=headers, verify=False)
	if r.status_code == 200:
		jsonResponse = r.json()
		sponsorPortlalId = json.dumps(jsonResponse['SearchResult']['resources'][1]['id'], indent=4).strip('"')
		return sponsorPortlalId

def getSponsorId():
	url = f"https://{ip}:{port}{uris['sponsor']}"
	headers = httpHeader(authB64ADM)
	parameters = {
		"size": 100
	}
	r = requests.get(url, headers=headers, params=parameters, verify=False)	
	if r.status_code == 200:
		jsonResponse = r.json()
		for index in jsonResponse['SearchResult']['resources']:
			if usernameERS in index['name']:
				return index['id'].strip('"')

def createGuestUser(numOfDays):
	fromDate  = ( dt.now() ).strftime( "%m/%d/%Y %H:%M" )
	toDate    = ( dt.now() + td( days=numOfDays ) ).strftime( "%m/%d/%Y %H:%M" )
	validDays = numOfDays
	payload = {
		"GuestUser": {
			"guestType": "ERS_GuestType",
			"personBeingVisited": "internal.user@mycompa.ny",
			"reasonForVisit": "Visit",
			"portalId": sponsorPortalID,
			"sponsorUserName": usernameERS,
			"sponsorUserId": sponsorID,
			"guestInfo": {
				"firstName": "Guest",
				"lastName": "Guest",
				"emailAddress": "guest@gue.st",
				"company": "Guest Company",
				"phoneNumber": "+1234567890",
			},
			"guestAccessInfo": {
				"validDays": validDays,
				"location":  "(UTC+01:00)",
				"fromDate":  fromDate,
				"toDate":    toDate
			},
			"customFields": {}
		}
	}
	jsonPayload = json.dumps(payload, indent=4)
	url = f"https://{ip}:{port}{uris['guestuser']}"
	headers = httpHeader(authB64ERS)
	r = requests.post(url, headers=headers, data=jsonPayload, verify=False)
	print(r.status_code)
	print("")
	print(r.text)

sponsorPortalID = getSponsorPortalId()
sponsorID = getSponsorId()
createGuestUser(3)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 17:52:23 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4758870#M579337</guid>
      <dc:creator>Riccardo Atzeni</dc:creator>
      <dc:date>2023-01-20T17:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4760239#M579362</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/431994"&gt;@Riccardo Atzeni&lt;/a&gt;&amp;nbsp;, it would appear as per the script that you are not using the port used for ERS which is 9060 , please follow the next guidelines to configure API calls with guest users.&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;A href="https://www.cisco.com/c/en/us/support/docs/security/identity-services-engine/215476-configure-ise-guest-accounts-with-rest-a.html" target="_blank"&gt;https://www.cisco.com/c/en/us/support/docs/security/identity-services-engine/215476-configure-ise-guest-accounts-with-rest-a.html&lt;/A&gt;&lt;/P&gt;
&lt;P class="p1"&gt;Let me know if that helped you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 20:11:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4760239#M579362</guid>
      <dc:creator>Rodrigo Diaz</dc:creator>
      <dc:date>2023-01-23T20:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE API - Sponsor portal account creation</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4760888#M579375</link>
      <description>&lt;P&gt;Hello Rodrigo,&lt;/P&gt;
&lt;DIV&gt;&lt;SPAN&gt;thanks&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;answering.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Both ports (443 or 9060) should work as expected:&lt;BR /&gt;&lt;A href="https://developer.cisco.com/docs/identity-services-engine/latest/#!cisco-ise-api-framework/cisco-ise-api-service" target="_blank" rel="noopener"&gt;https://developer.cisco.com/docs/identity-services-engine/latest/#!cisco-ise-api-framework/cisco-ise-api-service&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"ERS APIs are REST APIs that are based on the HTTPS protocol and operate over the standard HTTPS port 443 (port 9060 can also be used)."&lt;/DIV&gt;
&lt;P&gt;Anyway, also using port 9060 I still have the same error.&lt;BR /&gt;&lt;BR /&gt;The user is created but java returns a timeout error, it is something else.&lt;BR /&gt;&lt;BR /&gt;=================================== vvv UPDATE 1 vvv ===================================&lt;BR /&gt;I tested the same script on my old infrastructure (ISE 2.4) and everything is working as expected&lt;BR /&gt;On the new one (ISE 3.1), with the same request, I still receiving HTTP 500&lt;BR /&gt;=================================== ^^^ UPDATE 1 ^^^ ===================================&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 11:51:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-api-sponsor-portal-account-creation/m-p/4760888#M579375</guid>
      <dc:creator>Riccardo Atzeni</dc:creator>
      <dc:date>2023-01-25T11:51:03Z</dc:date>
    </item>
  </channel>
</rss>

