1.11. http://localhost:7080/rest/resource : Resource related
This endpoint deals with individual resources, not resource groups
Defining class: org.rhq.enterprise.server.rest.ResourceHandlerBean
Produces: application/json, application/xml, text/html, application/vnd.rhq.wrapped+json
Methods
GET /resource/{id:\d+}
Description
Retrieve a single resourceParameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to retrieve true int all Return type: ResourceWithType
Error codes: Code Reason 404 If no resource with the passed id exists PUT /resource/{id:\d+}
Description
Update a single resource or import a new resource from the discovery queue.Notes
You can either update a resource that is already in inventory, in which case the fieldsname, description and location can be updated. Or you can import a Platform or Server resource that is in state NEW.To do this you need to PUT the resource retrieved with a COMMITTED state
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to import true int all -body- Resource to update true ResourceWithType all Return type: ResourceWithType
Error codes: Code Reason 404 If no resource with the passed id exists 406 Tried to update a resource that is not COMMITTED GET /resource/search
Description
Search for resources based on query parametersNotes
You can use any parameters based on org.rhq.core.domain.criteria.ResourceCriteria#addFilter*, , but note that only one value is passed to filter method (even if it may support multiple values). For example parameter name=value transforms to ResourceCriteria#addFilterName(value), parameter pluginName=value transforms to ResourceCriteria#addFilterPluginName(value). For some parameter names, following are equivalent : status=inventoryStatus, availability=currentAvailability, category=resourceCategories, plugin=pluginName, parentId=parentResourceId, parentName=parentResourceName, type=resourceTypeName. For example, to find all running AS7 Standalone Servers on a platform do GET /resource/search?parentId=10001&type=JBossAS7 Standalone Server&availability=UP
Supports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value ps Query Page size for paging false int all 20 page Query Page for paging, 0-based false Integer all 0 strict Query Enable strict filtering false boolean all false Return type: ResourceWithType
Error codes: Code Reason 406 The passed inventory status was invalid GET /resource
Description
Search for resources by the given search string, possibly limited by category and pagedSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value q Query Limit results to param in the resource name false String all category Query Limit to category (PLATFORM, SERVER, SERVICE false String all ps Query Page size for paging false int all 20 page Query Page for paging, 0-based false Integer all 0 status Query Limit to Inventory status of the resources false String ALL, NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED COMMITTED Return type: ResourceWithType
Error codes: Code Reason 406 The passed inventory status was invalid GET /resource/platforms
Description
List all platforms in the systemSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value ps Query Page size for paging false int all 20 page Query Page for paging, 0-based false Integer all 0 Return type: ResourceWithType (multi)
GET /resource/{id}/hierarchy
Description
Retrieve the hierarchy of resources starting with the passed oneSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to start with true int all Return type: ResourceWithType (multi)
Error codes: Code Reason 404 If no resource with the passed id exists GET /resource/{id}/availability
Description
Return the current availability for the passed resourceParameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to query true int all Return type: AvailabilityRest
Error codes: Code Reason 404 If no resource with the passed id exists GET /resource/{id}/availability/history
Description
Return the availability history for the passed resourceSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to query true int all start Query Start time false long all 30 days ago end Query End time false long all Now Return type: AvailabilityRest (multi)
Error codes: Code Reason 404 If no resource with the passed id exists GET /resource/{id}/availability/summary
Description
Return the availability history for the passed resourceParameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to query true int all Return type: AvailabilitySummary
Error codes: Code Reason 404 If no resource with the passed id exists PUT /resource/{id}/availability
Description
Set the current availability of the passed resourceParameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to update true int all -body- New Availability setting true AvailabilityRest all Return type: void
GET /resource/{id}/schedules
Description
Get the metric schedules of the passed resource idSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to obtain the schedules for true int all type Query Limit by type false String <empty>, all, metric, trait, measurement all enabledOnly Query Limit by enabled schedules false boolean all true name Query Limit by name false String all Return type: MetricSchedule (multi)
Error codes: Code Reason 404 If no resource with the passed id exists GET /resource/{id}/children
Description
Get the direct children of the passed resourceSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to get children true int all ps Query Page size for paging false int all 20 page Query Page for paging, 0-based false Integer all 0 q Query Limit results to param in the resource name false String all category Query Limit to category (PLATFORM, SERVER, SERVICE) false String all status Query Limit to Inventory status of the resources false String ALL, NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED COMMITTED Return type: javax.ws.rs.core.Response
Error codes: Code Reason 404 If no resource with the passed id exists GET /resource/{id}/alerts
Description
Get a list of links to the alerts for the passed resourceSupports returning a gzip'ed Content-Encoding
Parameters: Name P.Type Description Required Type Allowed values Default value id Path Id of the resource to query true int all Return type: List<Link>
Error codes: Code Reason 404 If no resource with the passed id exists POST /resource/platform/{name}
Description
Create a new platform in the Server. If the platform already exists, this is a no-op.The platform internally has a special name so that it will not clash with one that was generated via a normal RHQ agent. DEPRECATED Use POST /platforms insteadParameters: Name P.Type Description Required Type Allowed values Default value name Path Name of the platform true String all -body- Type of the platform true StringValue Linux,Windows,... TODO Return type: javax.ws.rs.core.Response
POST /resource/platforms
Description
Create a new platform in the Server. If the platform already exists, this is a no-op.The platform internally has a special name so that it will not clash with one that was generated via a normal RHQ agent. Only resourceName and typeName need to be supplied in the passed objectParameters: Name P.Type Description Required Type Allowed values Default value -body- The info about the platform. Only type name and resource name need to be supplied true ResourceWithType all Return type: javax.ws.rs.core.Response
POST /resource/{name}
Description
Create a resource with a given type below a certain parent. DEPRECATED Use POST / insteadParameters: Name P.Type Description Required Type Allowed values Default value name Path Name of the new resource true String all -body- Name of the Resource type true StringValue all plugin Query Name of the plugin providing the type false String all parentId Query Id of the future parent to attach this to false int all Return type: javax.ws.rs.core.Response
POST /resource
Description
Create a new resource as a child of an existing resource.Notes
If a handle is given, a content based resource is created; the content identified by the handle is not removed from the content store.If no handle is given, a resource is created from the data of the passed 'resource' object.
Parameters: Name P.Type Description Required Type Allowed values Default value -body- The info about the resource. You need to supply resource name, resource type name, plugin name, id of the parent true CreateCBResourceRequest all handle Query A handle that identifies content that has been uploaded to the server before. false String all Return type: javax.ws.rs.core.Response
Error codes: Code Reason 302 Creation is still happening. Check back with a GET on the Location. GET /resource/creationStatus/{id}
Description
Get the status of a resource creation for content based resources.Parameters: Name P.Type Description Required Type Allowed values Default value id Path none int -all- -none- Return type: javax.ws.rs.core.Response
Error codes: Code Reason 302 Creation is still going on. Check back later with the same URL. DELETE /resource/{id}
Description
Remove a resource from inventoryNotes
This operation is by default idempotent, returning 204.If you want to check if the resource existed at all, you need to pass the 'validate' query parameter.
Parameters: Name P.Type Description Required Type Allowed values Default value id Path none int -all- -none- physical Query none false boolean all false validate Query Validate that the resource exists false boolean all false Return type: javax.ws.rs.core.Response
Error codes: Code Reason 204 Resource was removed or did not exist with validation not set 404 Resource did not exist and validate was set