Policies
The following table lists the properties that can be used in the body of a policy request and/or are provided in the response body. (In the "Optional" column, if a default value is applicable, it is listed in angle brackets (< >).)
Resource: Policies
| Property Name | Type | Editable | Filter/Sort | Optional in Request/Response Body? | Description |
|---|---|---|---|---|---|
| guid | String | No | Neither | Optional on create only, but not on any subsequent uses . | The unique identifier for this policy. |
| name | String | Yes | sortBy, like | No | The display name for this policy; must be unique. |
| description | String | Yes | sortBy, like | Yes | A string that can be used by third-party consumers. The string can be referenced using RADIUS attribute variables such as: DPSK.THIRDPARTY_ID |
| rule | <Object> embedded | Yes | Neither | Optional on create only, but not on any subsequent uses . | The rules that are defined for this policy. Refer to the "Resource: rule" table below. |
| links[] | Link array | Yes | No | No | This is an href link to the RADIUS attribute group property
(attributeGroup) being used by the policy. This href can then be used in
other API calls.
Note: You can change the attribute group of a policy by
using a PUT request and including the href link to the new attribute
group.
|
Resource: rule
| Property Name | Type | Editable | Filter or Sort | Optional? | Description |
|---|---|---|---|---|---|
| userNameRegex | String | Yes | Neither | Yes | The regex for a user name that will be applied with this policy. |
| nasIdRegex | String | Yes | Neither | Yes | The regex for the NAS Identifier that will be applied with this policy. |
| realmRegex | String | Yes | Neither | Yes | The regex for the realm that will be applied with this policy. The realm is defined as "@***" following the user name. For example, with joe.smith@company.com the realm is company.com |
| dpskRefNameRegex | String | Yes | Neither | Yes | The regex for the DPSK reference name that will be applied with this policy. This value is valid only for eDPSK Pools and is ignored for all other uses. |
| authGroupRegex | String | Yes | Neither | Yes | The regex for the authentication groups that will be applied with this policy. |
| timeRange | <Object> embedded | Yes | Neither | Yes | The regex for the time range that will be applied with this policy. |
| links | Link <Object> | Yes | Neither | Yes | This is an href link to the RADIUS client property (radiusClient) if
this property is being used by the policy. This href can then be used in
the "rule" portion of a request body as in this example (where "234" is
the ID of the RADIUS client):"links": [
{
"rel": "radiusClient",
"href": "https://somehost.cp.com/radius/client/234"
}
]Also, refer to RADIUS Clients. |
Resource: timeRange
| Property Name | Type | Editable | Filter or Sort | Optional? | Description |
|---|---|---|---|---|---|
| when | Enum <String> | Yes | Neither | No | When the policy will be applied:WEEKDAY, WEEKEND, ALL |
| start | String <Time> | Yes | Neither | No | The time specified for this policy to allow access, in ISO 8601 formatted time. |
| end | String <Time> | Yes | Neither | No | The time specified for this policy to prevent access, in ISO 8601 formatted time. |
Policies URIs and Actions
The following table indicates the URIs that you can append to the root URI, along with the actions you can take, and possible return codes you can receive.
Policies URIs and Actions
Example of Using POST to Create a Policy
This example demonstrates how to create a new policy in your Cloudpath system by using the REST API POST call.
This example uses the following URI:
https://Jeff243.cloudpath.net/admin/apiv2/5XcTc6SjkHDL/policies
- https://Jeff243.cloudpath.net/admin/apiv2 is the root URI of the Cloudpath system being used (must include https, as shown)
- 5XcTc6SjkHDL is an example of an API key generated from the Configuration > API Keys section of the Cloudpath UI
The following table shows the required request headers for this URI example, with an example value of an active token that must be pasted into the Authorization header value:
Request Headers
| Key | Value |
|---|---|
| Content-type | application/json |
| Authorization | eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqZWZmLnJob2RpZUBjb21tc2NvcGUuY29tIiwicm9sZVBrIjoiMjEwMDAiLCJhY2NvdW50QWRtaW5QayI6IjIiLCJhcGlLZXkiOiJaV2NjTGpQZUdZMGUiLCJpYXQiOjE1NzU1NzUxNTcsImV4cCI6MTU3NTU3NTQ1N30.2q4KTyDUevkAAz7mJyp529Be1-ip3EC8P06Xarmz5ao |
The following is an example of a request body for creating a policy. You can refer to the preceding Resource tables for a list and descriptions of properties you can use to define your policy. For instance, in this example, a policy called "policy2" is being created with the values provided in the body.
{
"name":"Policy2",
"description":"Test Policy2 using Attribute1 and with userNameRegex and timeRange",
"rule":{
"userNameRegex":"user*",
"nasIdRegex":"Using Attribute",
"realmRegex":"",
"dpskRefNameRegex":"",
"authGroupRegex":"","links":[],
"timeRange": {
"when": "WEEKEND",
"startTime": "07:45:00",
"endTime": "16:15:00"
},
"links": []
},
"links":[
{
"rel":"attributeGroup",
"href": "https://jeff243.cloudpath.net/admin/apiv2/5XcTc6SjkHDL/radiusAttributeGroups/1"
}
]
}
Use the POST action to send the request.
Once the request is sent, you will receive a "Status: 201 Created" if the POST is successful. You can see that a "guid" (a unique identifier for the newly created policy) is included in the response body.
{
"guid": "2",
"name": "Policy2",
"description": "Test Policy2 using Attribute1 and with userNameRegex and timeRange",
"rule": {
"userNameRegex": "user*",
"nasIdRegex": "Using Attribute",
"realmRegex": "",
"dpskRefNameRegex": "",
"authGroupRegex": "",
"timeRange": {
"when": "WEEKEND",
"startTime": "07:45:00",
"endTime": "16:15:00"
},
"links": []
},
"links": [
{
"rel": "self",
"href": "https://jeff243.cloudpath.net/admin/apiv2/5XcTc6SjkHDL/policies/2",
"hreflang": null,
"media": null,
"title": null,
"type": null,
"deprecation": null
},
{
"rel": "attributeGroup",
"href": "https://jeff243.cloudpath.net/admin/apiv2/5XcTc6SjkHDL/radiusAttributeGroups/1",
"hreflang": null,
"media": null,
"title": null,
"type": null,
"deprecation": null
}
]
}