Retiring a service


#1

I’m trying to solve the following problem:

  1. I order a service using the service catalogs / service templates.
    https://localhost/api/service_catalogs/317000000000001/service_templates

  2. The response provides service_requests endpoint to status the order until completion.

  3. A service is created under My Services

  4. Let’s say 3 weeks later I want to retire this service via the api:
    https://localhost/api/services/

How do I determine what the services id is via the api? It isn’t provided in the initial response or the order call or the status call to the service_requests endpoint. I’m trying to capture information on the order that I can then use later to retire and I’m not sure how to do that. Any insight would be great! Thanks!


#2

@gtanzillo can you review this question from @tobmat and forward to another SME if necessary.


#3

One way is if you know the name of the new service that will be created when ordering it via the service_templates, then you can find it via:

GET /api/services?expand=resources&filter[]=name='<name_of_service>'

The other way is to find the service by service request id, when you order the service via:

POST /api/service_catalogs/<service_catalog_id>/service_templates/<service_template_id>

You get the service_request back which would have an id.

Assuming the service order is approved and goes through and the service is created, then you can search for that service via the service_request id as follows:

GET /api/services?expand=resources&filter[]=miq_request.id=<service_request_id>

which you can then retire as per http://manageiq.org/docs/reference/latest/api/reference/services#service-retiring-now

Hope this helps,

Alberto