Handling application domains with Secure Private Access on-premises API
This topic provides instructions on how to create, list, search, reset, update, and delete application domains using the Secure Private Access API. Before starting with this API, understand the mandatory headers for all requests listed in Getting Started.
1. Get list of application domains
The following is an example of a GET request and response for getting a list of application domains:
GET https://{ hostUrl }:{ port }/accessSecurity/routingDomains
Request header sample
...
Accept: application/json
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Request parameters
A set of optional parameters can be used in the GET request:
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
offset | Positive Integer | Starting index of the returned collection. Default is 0. |
limit | Positive Integer | Ending index (excluding) of the returned collection. It must always be offset < limit. Default is 1000. |
orderby | String | The field used to sort the returned list. Fields that can be used with orderby are fqdn , type , flag , comment and ip . |
status | Boolean | Fetch status of routing domains instead of full list. |
A sample URL:
GET https://{ hostUrl }:{ port }/accessSecurity/routingDomains?status=true&offset=10&limit=20&orderby=fqdn
This API invocation requests ten items, starting with the one with index 10, from the collection of application domains whose status is true
and are ordered by the fqdn
field.
Successful response sample with status parameter false
A 200 OK
response with a JSON body:
{
"totalNum": a_number_here,
"status": {
"statusCode": 0,
"errCount": 0
},
"items": [
{
...Application Domain #1...
},
{
...Application Domain #2...
},
{
...Application Domain #3...
}
]
}
<!--NeedCopy-->
The JSON object has a status
property that contains statusCode
and errCount
. Also, the JSON object has an items
property that contains all the routing domains. Finally, totalNum
property is included, which contains the total number of application objects that would be returned regardless of the pagination parameters.
Application domains object schema in response body with status parameter value false
Each application domain object in the items
array contains the following schema. Each property value is given as a string unless differently specified.
-
status
. The routing entry status.-
statusCode
. The status code. -
errCount
. The number of errors.
-
-
items
. The list with the routing domains.-
id
. The Routing Domain identifier (unique). -
fqdn
. The FQDN which must be routed. Max domain length 255 characters. -
type
. Type of routing entry. Fields that can be used areinternal
,external
. -
flag
. Routing entry isenabled
ordisabled
. The default value isenabled
. -
error
. Any error associated with this routing entry. The default value isnone
. -
comment
. Admin to add some description to a routing entry. Max comment length 64 characters. -
appType
(optional). The type of app binding to this routing entry. It could beSAAS
,WEB
,ZTNA
orEMPTY
-
ip
(optional). A boolean variable. Whether the secure access app has IP address-based configuration. The default value isFalse
.
-
Successful response sample with status parameter value true
A 200 Status OK
response with a JSON body:
{
"status": {
"statusCode": 0,
"errCount": 0
}
}
<!--NeedCopy-->
The JSON object also has a status
property that contains statusCode
and errCount
.
Application domains object schema in response body
Each application domain object in the items
array contains the following schema. Each property value is given as a string unless differently specified.
-
status
. The routing entry status.-
statusCode
. The status code. -
errCount
. The number of errors.
-
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
400 BAD REQUEST | A parameter was not given by the correct type. The JSON object in the response body usually provides enough information about the error. |
401 UNAUTHORIZED | An invalid token in the Authorization header. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
2. Get a specific application domain
The following is an example of a GET request and response for getting a specific application domain. The application domain is appended to the request URL:
GET https://{ hostUrl }:{ port }/accessSecurity/routingDomains/{ applicationDomain }
Request header sample
...
Accept: application/json
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Successful response sample
A 200 OK
response with a JSON body that contains an application domain object:
{
"id": "XBjh4a",
"flag": "disabled",
"fqdn": "test.com",
"appType": "",
"ip": false,
"comment": "this is a test",
"type": "external",
"error": "none"
}
<!--NeedCopy-->
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
401 UNAUTHORIZED | An invalid token in the Authorization header. |
404 NOT FOUND | No application domain with this name found. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
3. Create application domain
The following is an example of a POST request and response for adding a new application domain:
POST https://{ hostUrl }:{ port }/accessSecurity/routingDomains
Request header sample
...
Accept: application/json
Content-Type: application/json; charset=utf-8
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Request body sample
{
"fqdn": "www.testrouting.com",
"type": "external",
"flag": "enabled",
"error": "none",
"comment": "",
"appType": "",
"ip": false
}
<!--NeedCopy-->
Successful response sample
A 201 CREATED
response with a JSON body:
{
"id": "hHhcZw",
"fqdn": "www.testrouting.com",
"type": "external",
"flag": "enabled",
"comment": "",
"appType": "",
"ip": false,
"error": "none"
}
<!--NeedCopy-->
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
400 BAD REQUEST | JSON object sent in the request body might not follow the correct schema. The JSON object in the response body usually provides enough information about such a mistake. |
401 UNAUTHORIZED | An invalid token in the Authorization header. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
409 CONFLICT | Routing Domain already exists |
415 UNSUPPORTED MEDIA TYPE |
Content-Type header not set to application/json; charset=utf-8 . |
4. Update application domain
The following is an example of a PUT request and response for Updating a specific application domain. The application domain is appended to the request URL:
PUT https://{ hostUrl }:{ port }/accessSecurity/routingDomains/{ applicationDomain }
Request header sample
...
Accept: application/json
Content-Type: application/json; charset=utf-8
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Request body sample
{
"fqdn": "www.testrouting.com",
"type": "external",
"flag": "enabled",
"locationIds": [],
"error": "none",
"comment": "",
"appType": "",
"ip": false
}
<!--NeedCopy-->
Successful response sample
A 204 NO CONTENT
response with an empty body.
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
400 BAD REQUEST | JSON object sent in the request body might not follow the correct schema. The JSON object in the response body usually provides enough information about such a mistake. |
401 UNAUTHORIZED | An invalid token in the Authorization header. |
404 NOT FOUND | No application domain with this name found. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
415 UNSUPPORTED MEDIA TYPE |
Content-Type header not set to application/json; charset=utf-8 . |
5. Delete application domain
The following is an example of a DELETE request and response for deleting a specific application domain. The application domain is appended to the request URL:
DELETE https://{ hostUrl }:{ port }/accessSecurity/routingDomains/{ applicationDomain }
Request header sample
...
Accept: application/json
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Successful response sample
A 204 NO CONTENT
response with an empty body.
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
400 BAD REQUEST | A Request error occurred. |
401 UNAUTHORIZED | An invalid token in the Authorization header. |
404 NOT FOUND | No application domain with this name found. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
409 CONFLICT | Cannot change app connectivity for IP based destinations or Routing Domain already exists |
7. Search for application domains
The following is an example of a POST request and response for search application domains:
POST https://{ hostUrl }:{ port }/accessSecurity/routingDomains/search
Request header sample
...
Accept: application/json
Authorization: bearer { bearerToken }
...
<!--NeedCopy-->
Request body sample
{
"fqdnList": ["www.testrouting1.com", "www.testrouting2.com", "www.testrouting3.com"]
}
<!--NeedCopy-->
JSON Object schema in request body
Each property value is given as a string unless differently specified.
-
fqdnList
. The list of FQDNs to search.
Successful response sample
A 200 OK
response with a JSON body:
{
"items": [
{
...Application Domain #1...
},
{
...Application Domain #2...
},
{
...Application Domain #3...
}
]
}
<!--NeedCopy-->
The property items
contains all the found routing domains requested from the fqdnList
.
Potential unsuccessful responses
Status Code - Description | Potential Reason |
---|---|
400 BAD REQUEST | A Request error occurred. |
401 UNAUTHORIZED | An invalid token in the Authorization header. |
406 NOT ACCEPTABLE |
Accept header not set to application/json . |
415 UNSUPPORTED MEDIA TYPE |
Content-Type header not set to application/json; charset=utf-8 . |