CoreService

<back to all web services

GetConfigItemHierarchy

Common - Requests

Return the object hierarchy of a configitem

Requires Authentication
Requires the role:TenantReader
The following routes are available for this service:
GET/api/configitems/{Id}/hierarchyReturns a list with ids of all parent items
GET/configitems/{Id}/hierarchyReturns a list with ids of all parent items
import Foundation
import ServiceStack

/**
* Return the object hierarchy of a configitem
*/
// @Api(Description="Return the object hierarchy of a configitem")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
// @ApiResponse(Description="Check log for more info", StatusCode=500)
public class GetConfigItemHierarchy : IBaseRequest, IHasTenantName, IGet, Codable
{
    // @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
    public var id:String

    /**
    * objecttype of searched configitem
    */
    // @ApiMember(Description="objecttype of searched configitem", IsRequired=true, ParameterType="query")
    // @Validate(Validator="NotNull")
    public var configItemType:ObjectTypes?

    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    public var tenantName:String

    // @ApiMember(DataType="string", Format="guid", ParameterType="query")
    public var txId:String

    required public init(){}
}

public enum ObjectTypes : String, Codable
{
    case None
    case ConfigItem
    case Tenant
    case Collection
    case Resource
    case ComputeNode
    case VirtualMachine
    case PhysicalMachine
    case Disk
    case Subnet
    case IPAddress
    case Job
    case JobEvent
    case FreezePeriod
    case ResourceGroup
    case Deployment
    case ResourceGroupTemplate
    case DeploymentTemplate
    case ResourceProvider
    case GenericResource
    case Role
    case Permission
    case User
    case PatchingWindow
    case Update
    case ReportDefinition
    case TimeSeries
    case DataPoint
    case Action
    case ActionAssignment
    case UserNote
}

public class ItemsResponse<T : Codable> : Codable
{
    public var items:IList<VariableDto>
    public var offset:Int
    public var total:Int
    public var isGrouped:Bool
    public var responseStatus:ResponseStatus
    public var meta:[String:String]

    required public init(){}
}

public class VariableDto : Codable
{
    public var name:String
    /**
    * Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false, List = [1,2,3,4]). Note: string values need extra quotes
    */
    public var value:String
    /**
    * The data type of the value property
    */
    public var type:ValueDataType
    public var Description:String
    public var isInherited:Bool
    public var environment:Environments?

    required public init(){}
}

public enum ValueDataType : String, Codable
{
    case String
    case Number
    case Boolean
    case List
}

public enum Environments : String, Codable
{
    case Lab
    case Poc
    case Dev
    case Test
    case Int
    case Uat
    case Prod
}


Swift GetConfigItemHierarchy DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/configitems/{Id}/hierarchy HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"items":null,"offset":0,"total":0,"isGrouped":false,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}