View Source

WAS THIS PAGE HELPFUL? {html}<a href=" Type APIs">Leave Feedback</a>{html}

h4. 13.0 Entity Type APIs

h5. 13.1 Query Entity Types

Retrieve entity types by query. There are two kinds of queries supported:
# Retrieve a single entityType. Retrieves exactly one entityType wrapped XML <entityType> element
# Retrieve one or more entity types . Retrieves 1..n entity type objects wrapped by an XML <entityTypes> collection

h6. 13.2 Method: GET Entity Types

{color:#4a86e8}GET /api/entitytypes?query=(query criteria see below){color}

h6. 13.3 Method: GET a single Entity Type by unique entity type name

{color:#4a86e8}GET /api/entitytypes/{color}{html}{entityTypeName}{html}

h6. 13.4 HTTP Query and Path Parameters

|| Field || Type || Description || Required ||
| query | Query | An encoded query string (where clause) | no \*\* |
| first | Query | Paging. First record to start from | no |
| count | Query | Paging. Number of records to include when paging | no |
| entityTypeName | Path | the unique name of the entity type | no \*\* |
_Note: \**If neither a entityType path parameter or query query parameter is not provided, all entityTypes will be retrieved._

h6. 13.5 HTTP Headers

|| Header || Valid Values || Required ||
| Content-Type | application/xml or application/json | True |
| GWOS-API-TOKEN | a valid token returned from login | True |
| GWOS-APP-NAME | your application name | True |

h6. 13.6 Query Fields

|| Field || Description || Alias ||
| id | Entity Type integer id | entityTypeId |
| name | The entity type primary unique name | &nbsp; |
| description | The description of this property type | &nbsp; |
| isLogicalEntity | Boolean flag set if a logical entity | &nbsp; |
| applicationTypeSupported | Boolean flag for application type support | &nbsp; |
_Note: Query fields are case-insensitive, thus camelCase, or all lower case will both work fine._
\***The fields entity

h6. 13.7 Example Queries

_These examples are not HTTP encoded for readability. In practice queries must be encoded._
# _query for all entity types_
{color:#4a86e8}GET /api/entitytypes{color}
# _query for all entity types, order by name descending_
{color:#4a86e8}GET /api/entitytypes?query=order by name desc{color}
# _query for a single entityType named ‘DEVICE’_
{color:#4a86e8}GET /api/entitytypes/DEVICE{color}
# _a like query to find all entity types in list_
{color:#4a86e8}GET /api/entitytypes?query=name in (‘DEVICE','HOST,'CATEGORY){color}

*Example Query Results in XML*

The normal results of a query will result in either HTTP 200 OK status or a HTTP 404 NOT FOUND status.

Results of requesting a single entity with a entity type name in the path parameter is always wrapped with a single {{<entityType>}} element. Here is an XML example of the result of a query finding one entity type. All fields are displayed as attributes.
{code}<entityType id="15" name="STATE_TYPE"
isLogicalEntity="false" applicationTypeSupported="false" />{code}

Result of queries are always wrapped in a <propertyTypes> collection element, with one or more {{<propertyType>}} subelements.
<entityType id="7" name="APPLICATION_TYPE"
isLogicalEntity="false" applicationTypeSupported="false" />
<entityType id="8" name="CATEGORY"
isLogicalEntity="false" applicationTypeSupported="false" />
<entityType id="9" name="CHECK_TYPE"
isLogicalEntity="false" applicationTypeSupported="false" />
<entityType id="10" name="COMPONENT"
isLogicalEntity="false" applicationTypeSupported="false" />

See [Appendix A|1.0 Appendix A Curl Examples] for examples of usage with Curl
See [Appendix B|2.0 Appendix B XML Example Data] and [Appendix C|3.0 Appendix C JSON Example Data] for example query data in both XML and JSON:
&nbsp;&nbsp;Response Data - [XML|2.0 Appendix B XML Example Data#Entity Types Query Response Data XML] \- [JSON|3.0 Appendix C JSON Example Data#Entity Types Query Response Data JSON]