WAS THIS PAGE HELPFUL? {html}<a href="mailto:training@gwos.com?subject=Biz Service Authorization APIs">Leave Feedback</a>{html}
h4. 27.0 Biz Service Authorization APIs
h5. 27.1 Get Service Authorization
Get authorized hosts, services, and service hosts based on authorized host and service groups. Authorized host and service groups are generally set by user role memberships managed externally. This service translates specified groups into a collection of hosts that have authorized access to all services and a map of host collections keyed by service that authorizes access to individual services on hosts. General API conventions are followed wrapping POST data and results for XML and JSON content types.
h6. {color:#333333}27.1.1 Method: POST Get Authorized Services{color}
{color:#4a86e8}POST /api/biz/getauthorizedservices{color}
h6. {color:#333333}27.1.2 POST Data Example{color}
Here is an XML example post data for accessing host group authorized service:
{code: language=html/xml}
<bizAuthorization>
<hostGroupNames>
<hostGroupName>Linux Servers</hostGroupName>
</hostGroupNames>
</bizAuthorization>
{code}
Here is an XML example of post data for accessing service group authorized services:
{code: language=html/xml}
<bizAuthorization>
<serviceGroupNames>
<serviceGroupName>local</serviceGroupName>
</serviceGroupNames>
</bizAuthorization>
{code}
Here is a JSON example post data for accessing both host and service group authorized services:
{code: language=javascript}
{
"hostGroupNames" : ["Linux Servers"],
"serviceGroupNames" : ["local"]
}
{code}
h6. {color:#333333}27.1.3 HTTP Headers{color}
|| Header || Valid Values || Required ||
| Content-Type | application/xml or application/json | False |
| Accept | application/xml or application/json | False |
| GWOS-API-TOKEN | a valid token returned from login | True |
| GWOS-APP-NAME | your application name | True |
h6. {color:#333333}27.1.4 HTTP Status Codes{color}
|| Code || Description ||
| 200 | Authorized hosts and services returned |
| 401 | Authentication/authorization error occurred |
| 404 | No authorization returned, (unlimited access can be assumed) |
| 500 | An internal server error occurred while querying host blacklists |
h6. {color:#333333}27.1.5 Example Results{color}
Here is an XML example of authorized hosts and services results. Note that service host maps are verbose when marshalled into XML. General API conventions are followed wrapping results with XML tags.
{code: language=html/xml}
<bizAuthorizedServices>
<hostNames>
<hostName>localhost</hostName>
</hostNames>
<serviceHostNames>
<serviceHostMap>
<serviceHostMapEntry serviceName="local_cpu_httpd">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_cpu_java">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_cpu_syslog-ng">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_swap">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_process_nagios">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="tcp_http">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
</serviceHostMap>
</serviceHostNames>
</bizAuthorizedServices>
{code}
Here is a JSON example of authorized hosts and services results. General API conventions are followed wrapping results with JSON objects.
{code: language=javascript}
{
"hostNames" : [ "localhost" ],
"serviceHostNames" : {
"local_cpu_httpd" : [ "localhost" ],
"local_cpu_java" : [ "localhost" ],
"local_cpu_syslog-ng" : [ "localhost" ],
"local_swap" : [ "localhost" ],
"local_process_nagios" : [ "localhost" ],
"tcp_http" : [ "localhost" ]
}
}
{code}
h4. 27.0 Biz Service Authorization APIs
h5. 27.1 Get Service Authorization
Get authorized hosts, services, and service hosts based on authorized host and service groups. Authorized host and service groups are generally set by user role memberships managed externally. This service translates specified groups into a collection of hosts that have authorized access to all services and a map of host collections keyed by service that authorizes access to individual services on hosts. General API conventions are followed wrapping POST data and results for XML and JSON content types.
h6. {color:#333333}27.1.1 Method: POST Get Authorized Services{color}
{color:#4a86e8}POST /api/biz/getauthorizedservices{color}
h6. {color:#333333}27.1.2 POST Data Example{color}
Here is an XML example post data for accessing host group authorized service:
{code: language=html/xml}
<bizAuthorization>
<hostGroupNames>
<hostGroupName>Linux Servers</hostGroupName>
</hostGroupNames>
</bizAuthorization>
{code}
Here is an XML example of post data for accessing service group authorized services:
{code: language=html/xml}
<bizAuthorization>
<serviceGroupNames>
<serviceGroupName>local</serviceGroupName>
</serviceGroupNames>
</bizAuthorization>
{code}
Here is a JSON example post data for accessing both host and service group authorized services:
{code: language=javascript}
{
"hostGroupNames" : ["Linux Servers"],
"serviceGroupNames" : ["local"]
}
{code}
h6. {color:#333333}27.1.3 HTTP Headers{color}
|| Header || Valid Values || Required ||
| Content-Type | application/xml or application/json | False |
| Accept | application/xml or application/json | False |
| GWOS-API-TOKEN | a valid token returned from login | True |
| GWOS-APP-NAME | your application name | True |
h6. {color:#333333}27.1.4 HTTP Status Codes{color}
|| Code || Description ||
| 200 | Authorized hosts and services returned |
| 401 | Authentication/authorization error occurred |
| 404 | No authorization returned, (unlimited access can be assumed) |
| 500 | An internal server error occurred while querying host blacklists |
h6. {color:#333333}27.1.5 Example Results{color}
Here is an XML example of authorized hosts and services results. Note that service host maps are verbose when marshalled into XML. General API conventions are followed wrapping results with XML tags.
{code: language=html/xml}
<bizAuthorizedServices>
<hostNames>
<hostName>localhost</hostName>
</hostNames>
<serviceHostNames>
<serviceHostMap>
<serviceHostMapEntry serviceName="local_cpu_httpd">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_cpu_java">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_cpu_syslog-ng">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_swap">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="local_process_nagios">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
<serviceHostMapEntry serviceName="tcp_http">
<hostNames>
<hostName>localhost</hostName>
</hostNames>
</serviceHostMapEntry>
</serviceHostMap>
</serviceHostNames>
</bizAuthorizedServices>
{code}
Here is a JSON example of authorized hosts and services results. General API conventions are followed wrapping results with JSON objects.
{code: language=javascript}
{
"hostNames" : [ "localhost" ],
"serviceHostNames" : {
"local_cpu_httpd" : [ "localhost" ],
"local_cpu_java" : [ "localhost" ],
"local_cpu_syslog-ng" : [ "localhost" ],
"local_swap" : [ "localhost" ],
"local_process_nagios" : [ "localhost" ],
"tcp_http" : [ "localhost" ]
}
}
{code}