Server components

This topic describes the server component parameters and the usage of the StarTeam REST API for working with server components.

Server component APIs

The following table shows the server component parameters supported for the StarTeam REST API:

Type

Usage

URL

/type

Method

GET

URL Params

Optional

Data Params

Optional: the session cookie returned during the log in.

Success Response

Returns a list of types available on server: ID, type name, and type internal name

For example: 

[{"Custom":false,"Customizable":true,"GUID":"8202f935-d901-11d0-95f8-0060976ea26d","ID":42,"ItemType":true,"Name":"Change Request","TreeType":false,"Type":"Change"}, {"Custom":false,"Customizable":true,"GUID":"3f650429-d29a-4c7e-b086-4a60d853678d","ID":51,"ItemType":true,"Name":"Requirement","TreeType":true,"Type":"Requirement"}, {"Custom":false,"Customizable":true,"GUID":"c52acfff-8f06-11d2-9fcf-00805f9b0df2","ID":60,"ItemType":true,"Name":"Task","TreeType":true,"Type":"Task"}]
Error response Example:

Sample Call

curl -g --cookie cookie.txt -X GET http://localhost:49206/serverapi/type

Back to top

GET - properties

The following section illustrates the usage of the GET method to retrieve the properties for a specific type:

Usage: GET: /type/{typeid}

Description: Gets the properties defined for type {typeid}.

Sample URL: The following URL returns properties for Change Request type: http://localhost:49206/serverapi/type/42

Response example

{"Name":"Change Request",

"Properties":[

{"DataType":1,"Default":0,"DisplayName":"CR Number","Flags":16908288,"ID":131072,"Name":"ChangeNumber","Type":131072,"UserModifiable":false},

{"DataType":8,"Default":"","DisplayName":"Synopsis","Flags":100794624,"ID":131073,"Max":20000,"Name":"Synopsis","Type":131072,"UserModifiable":true},{"DataType":2,"Default":0,"DisplayName":"Type","Enums":[{"Active":true,"Code":0,"DisplayName":"Defect","Flags":0,"Name":"","Order":0}],

"Type": "Change",

"TypeID": 42}

}

Back to top

PUT - properties

The following section illustrates the usage of the PUT method to add a custom property to a type:

Usage: PUT: /type/{typeid}

Description: Adds a custom property to type {typeid}.

Sample URL: http://localhost:49206/server.rest/type/42

Body example

{{

"DataType": 2,

"Default": 0,

"DisplayName": "MyStatus",

"Enums": [{"Active": true, "Code": 0, "DisplayName": "New","Flags": 0,"Name": "", "Order": 0},

{"Active": true, "Code": 1,"DisplayName": "Open","Flags": 0,"Name": "", "Order": 1}],

"Flags": 67239936,

"Name": "MyStatus",

"Type": 131072}

Response example

{"PropertyID":262144}

Back to top

GET - queries

The following section illustrates the usage of the GET method to retrieve a list of queries for the specified type:

Usage: GET: type/{typeid}/query

Description: Gets a list of queries defined for typeid. It includes all the query properties.

Sample URL: The following URL returns a list of queries defined for type 42 (Change Request): http://localhost:49206/serverapi/type/42/query

Response example

[[

{"ID":0,"Name":"Not a Priority","Projects":[],"Public":true,"RootNode":{"ChildNodes":[],"NodeType":0,"QueryParts":[{"Property":"Priority","RelationType":3,"Value":0}]}},

{"ID":1,"Name":"Priority","Projects":[],"Public":true,"RootNode":{"ChildNodes":[],"NodeType":0,"QueryParts":[{"Property":"Priority","RelationType":3,"Value":1}]}},

{"ID":2,"Name":"Status = Open","Projects":[],"Public":true,"RootNode":{"ChildNodes":[],"NodeType":0,"QueryParts":[{"Property":"Status","RelationType":3,"Value":1}]}}

Back to top

PUT - add properties query

The following section illustrates how the PUT method adds a query to retrieve the properties for a specific type:

Usage: PUT: type/{typeid}/query

Description: Adds a query for the typeid type, and returns all properties for the newly-created query.

Sample URL: The following URL returns a list of queries defined for type 42 (Change Request):
http://localhost:49206/serverapi/type/42/query

Body example

{

"Projects": [],

"Name": "MyQuery",

"Public": false,

"RootNode": {

"ChildNodes": [],

"NodeType": 1,

"QueryParts": [{ "Property": "Severity", "RelationType": 3, "Value": 2 },

{ "Property": "Responsibility", "RelationType": 3, "Value": -2 }]

} }

Response example

{"ID":14,"Name":"MyQuery","Projects":[],"Public":false,"RootNode":{"ChildNodes":[],"NodeType":1,"QueryParts":[{"Property":"Severity","RelationType":3,"Value":2},{"Property":"Responsibility","RelationType":3,"Value":-2}]},"UserID":0}

Back to top

POST - update properties query

The following section illustrates how the POST method updates a query to retrieve the properties for a specific type:

Usage: POST: type/{typeid}/query/{id}

Description: Updates the query {id} for typeid type and returns all properties for the newly-created query.

Sample URL: http://localhost:49206/serverapi/type/42/query/14

Body example

{

"Projects": [],

"Public": true,

"Name": "Severity Equals High "

}

Response example

{"ID":14,"Name":" Severity Equals High","Projects":[],"Public":true,"RootNode":{"ChildNodes":[],"NodeType":1,"QueryParts":[{"Property":"Severity","RelationType":3,"Value":2},{"Property":"Responsibility","RelationType":3,"Value":-2}]},"UserID":0}

Back to top

See also: