on 03-14-2017 10:41 AM - edited on 08-16-2023 07:21 AM by thomas
This guide will list Tips and Tricks around using Guest API calls working with Sponsors and guests
For other related API information, see
Use the Primary Policy Administration Node (PAN) on port 9060 for ISE < 3.1 unless using the sponsor portal URL.
ISE 3.1 and later may use the ISE API Gateway feature and use HTTPS on port 443 normally
If you try to do any CRUD operations (Create, Read, Update, Delete) with the ISE REST APIs for guests, you will likely receive an HTTP Status 401 – Unauthorized error message. This is a known issue:
CSCvd48557 - Ability to set the sponsor user with the guest API
The only way to create, read, update or delete Guest users is with a Sponsor account. When you create a guest account it sets the sponsor user to that of the sponsor calling the API. There is no way to override this. We will show you how to workaround this problem below. See the related TechZone article How to create guest accounts with API .
You should now be able to login to the SDK using the link https://YOUR-PAN-NAME:9060/ers/sdk :
You will need 2 different types of accounts to fully work with the Guest APIs. One for sponsor actions and one for changes of portal settings (if needed). To simply look at the SDK you will need an admin account (this has nothing to do with the sponsor account used to query or work with guest accounts).
In order to work with guest accounts you need to setup a Sponsor that is able to use the API.
Sponsor accounts are needed to perform CRUD operations guest accounts.
Under the sponsor group (ALL_ACCOUNTS) add ERS API access permission
If you need to setup an admin account that is able to work with the guest portal actions (changing portal settings) or looking at the SDK then follow these steps:
Its recommend to create a new guest for your API interactions. Also use FromFirstLogin type accounts unless needing to activate accounts at a certain time/date. Also see ISE Guest Types do i really need locations and timezones?
(A PortalId is necessary to create user)
GET /ers/config/portal HTTP/1.1
Host: <ise_admin_ip>:9060
Authorization: Basic XXXXX
Content-Type: application/vnd.com.cisco.ise.identity.portal.2.0+xml
Accept: application/vnd.com.cisco.ise.identity.portal.2.0+xml
When I am setting up my systems (example visitor management) and configuring a sponsor account to use. I want to send a call to ISE Guest API to validate this.
https://<ISE-ADMIN-NODE>:9060/ers/config/guestuser/versioninfo
Validate that you receive an HTTP Status 401 Unauthorized or not.
https://<ISE-ADMIN-NODE>:9060/ers/config/guestuser?filter=emailAddress.EQ.username@domain.org
To update guest user, we need to use only updateById.
Re-instantiate to move suspended guest to active account
The maximum duration comes from the guest type and the self-registration portal being used. The way to set an account with max duration is to fill out the three fields ( fromDate, toDate and validDays ) are properly filled. If longer than the “Maximum access duration” then API will throw error.
Username and password are optional and can be dynamically generated.
POST /ers/config/guestuser HTTP/1.1
Host: <ise_admin_ip>:9060
Authorization: Basic XXXXX
Content-Type: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Accept: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
<?xml version="1.0" encoding="UTF-8"?>
<ns2:guestuser xmlns:ns2="identity.ers.ise.cisco.com">
<guestAccessInfo>
<fromDate>06/01/2016 00:01</fromDate>
<toDate>06/02/2016 23:59</toDate>
<validDays>1</validDays>
<location>San Jose</location>
</guestAccessInfo>
<guestInfo>
<firstName>John</firstName>
<lastName>Jones</lastName>
<userName>john</userName>
</guestInfo>
<guestType>Daily</guestType>
<personBeingVisited>john@cisco.com</personBeingVisited>
<portalId>76c18c50-2a34-11e5-82cb-005056bf2f0a</portalId>
</ns2:guestuser>
{
"GuestUser": {
"guestType": "Contractor (default)",
"portalId": "6b93b3f0-26dd-11e8-a836-005056872c7f",
"guestAccessInfo": {
"validDays": 91,
"fromDate": "03/19/2018 17:47",
"toDate": "06/17/2018 17:47",
"location": "San Jose"
},
"customFields": {}
}
}
At present, please use XML instead of JSON for bulk operations, as JSON not supported for bulk.
https://psnip:9060/ers/config/guestuser/bulk/submit
Note: portalId needs to be replaced with one found on your ISE using ERS API for “portal”
Required: fromDate, location, toDate, validDays, and portalId
Submit the XML file above using cURL :
curl -v --tlsv1 -d @add_guest_user.xml -k \
--header "Content-Type: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml; charset=utf-8" \
--user $ISE_REST_USERNAME:$ISE_REST_PASSWORD \
'https://ise-pan.domain.com:9060/ers/config/guestuserers-password@ise-pan.domain.com:9060/ers/config/guestuser'
Get generated password and maybe username – filters in green optional)
GET /ers/config/guestuser/?filter=firstName.EQ.Vish&filter=lastName.EQ.JonesHTTP/1.1
Host: <ise_admin_ip>:9060
Authorization: Basic XXXXX
Content-Type: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Accept: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Use non-sponsor admin that has access to the ERS APIs
Headers:
GET /ers/config/portal
Host: <ise_admin_ip>:9060
Accept: application/vnd.com.cisco.ise.identity.portal.2.0+xml
Authorization: Basic YXBpOkFwcGxlMTIz
Response:
Content-Type: application/vnd.com.cisco.ise.ers.searchresult.2.0+xml;charset=utf-8
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ns3:searchResult total="4" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns3="ers.ise.cisco.com">
<resources>
<resource description="Default portal used by sponsors to create and manage accounts for authorized visitors to securely access the network" id="a6f50970-2230-11e6-99ab-005056bf55e0" name="sponsor">
<link rel="self" href="https://<ise_admin_ip>:9060/ers/config/portal/a6f50970-2230-11e6-99ab-005056bf55e0" type="application/xml"/>
</resource>
<resource description="Guests are allowed to create their own accounts and access the network using their assigned username and password" id="a692c530-2230-11e6-99ab-005056bf55e0" name="Self-Registered Guest Portal (default)">
<link rel="self" href="https://10.0.0.121:9060/ers/config/portal/a692c530-2230-11e6-99ab-005056bf55e0" type="application/xml"/>
</resource>
<resource description="Sponsors create guest accounts, and guests access the network using their assigned username and password" id="a65b8890-2230-11e6-99ab-005056bf55e0" name="Sponsored Guest Portal (default)">
<link rel="self" href="https://<ise_admin_ip>:9060/ers/config/portal/a65b8890-2230-11e6-99ab-005056bf55e0" type="application/xml"/>
</resource>
</resources>
</ns3:searchResult>
Headers:
POST /ers/config/guestuser
Host: <ise_admin_ip>:9060
Content-Type: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Accept: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Authorization: Basic YXBpOkFwcGxlMTIz
Payload - must follow this template, changing only the parameters in yellow:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ns4:guestuser xmlns:ers="ers.ise.cisco.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns4="identity.ers.ise.cisco.com">
<customFields>
<entry>
<key>ui_sponsorname_text_label</key>
<value>John Jones</value>
</entry>
</customFields>
<guestAccessInfo>
<fromDate>09/01/2016 09:49</fromDate>
<location>San Jose</location>
<toDate>09/01/2016 17:48</toDate>
<validDays>1</validDays>
</guestAccessInfo>
<guestInfo>
<enabled>true</enabled>
<firstName>Susan</firstName>
<lastName>Storm</lastName>
<notificationLanguage>English</notificationLanguage>
</guestInfo>
<guestType>APIGuestType</guestType>
<portalId>72317030-5a8d-11e6-87e1-000c292eb29b</portalId>
</ns4:guestuser>
Response:
Content-Type: application/xml;charset=utf-8
Location: https://10.0.0.121:9060/ers/config/guestuser/f4705ee2-748b-11e6-9e5e-000c2958a9f6
Query with the ID generated for the Guest account:
curl --insecure --location \
--header 'Accept: application/json' \
--user $ISE_REST_USERNAME:$ISE_REST_PASSWORD \
--request GET https://$ISE_HOSTNAME:9060/ers/config/guestuser/{id}
Use the sponsor portal:
curl -X PUT -k -i \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--user $ISE_SPONSOR_USERNAME:$ISE_SPONSOR_PASSWORD \
'https://ise:9060/ers/config/guestuser/email/11c276c0-05b4-11e9-a436-005056abd9c7/portalId/{portal-id}' \
--data '
{
"OperationAdditionalData" : {
"additionalData" : [ {
"name" : "senderEmail",
"value" : "sponsor@demo.local"
} ]
}
}
'
Can I use the Guest API to create web pages or guest approval flow? No you would have to do this via your own system
anyone else getting 401 Unauthorized for guest user/sponsor api calls? I followed all the steps but when i run the following, get a 401:
https://<ISE-ADMIN-NODE>:9060/ers/config/guestuser/versioninfo
ERSAdmin account works fine when getting portal ID.
Here is a screenshot of postman:
Thanks,
Rey
Hi ,
I need help for creating on REST API- Guest account - daily change username /password, and publish to Intranet.
Hello Everyone,
I'm facing a strange error using the APIs: I'm trying to create a user on ISE 3.1, the user is created if I get a look via GUI to the sponsor portal but every time I'm receiving the following error:
{
"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://<IPADDRESS>:<PORT>/ers/config/guestuser",
"type" : "application/xml"
}
}
}
Can you help me to understand what is happening?
Is it a requirement for the sponsor API that the Sponsor Portal authentication is set to Sponsor_Portal_Sequence or similar basic authorization? If the Sponsor Portal is set to SAML authentication, can the method above used for API?
I'm taking for granted that the data shown in the section
Creating a GuestUser without Username and Password
are the minimum for the user to be created.
I wonder if in the dict ""guestAccessInfo", the three fields "validDays", "fromDate", and "toDate" are all mandatory and what happens if there is an inconsistency among them.
Regards,
Gio
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: