Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
how do I, using C# API, get the Segment ID after using createSegment function
Solved! Go to Solution.
To list the segments or items within that are assigned to a project, you need to use im issues. If you already have a query that returns all items for the project, you can use that in the options. For example:
im issues --query="Items in Release1"
If you don't have a query, there's a couple options. You could create a query to use. Or you can use the --queryDefinition option for im issues:
im createquery --name="Items in Release1" --queryDefinition="(field["Project"] = "/Projects/Release1")"
OR
im issues --queryDefinition="(field["Project"] = "/Projects/Release1")"
To list only segment items, the queryDefinition is
"((field["Project"] = "/Projects/Release1") and (item.segment))"
Note: The list of published commands for the API can be found in the Integrations Builder Guide. these are the commands that we guarantee to work and give expected responses in the API.
Information on specific commands (such as options, syntax, output) is found in the Online Help under the CLI Reference section.
The segment ID will be in the response. Here's an example response from the createSegment command:
Response: App. Name = im Command Name = createsegment Result: Message = Document created with ID 40932 Field: Name = resultant Data Type = mksItem Item: Id = 40932 Context = NULL Model Type = im.Issue.segment Exit Code = 0
Documentation for the various functions to use can be found your Integrity Server homepage by following the ANSI C API Documentation link.
The direct link for documentation for files mksCommand.h, mksResponse.h:
using your Integrity Server values for <hostname> and <port>
Tip: You can get the API response for any command by using the mksapiviewer. For example, the command for the above response is:
mksapiviewer --iplocal im createsegment --type="Input Document" --field=Project="/Projects/Release1" --field="Document Short Title"="Testing createsegment command"
Documentation on mksapiviewer can be found in the Integrations Builder Guide.
one more question.....Is there a API comand to get a list of all the projects available?
"im projects" will give you a list of projects.
ok...it was not the my last question...lol
Is there a API command to list the segments and/or items within a project? BTW you have been very helpful
To list the segments or items within that are assigned to a project, you need to use im issues. If you already have a query that returns all items for the project, you can use that in the options. For example:
im issues --query="Items in Release1"
If you don't have a query, there's a couple options. You could create a query to use. Or you can use the --queryDefinition option for im issues:
im createquery --name="Items in Release1" --queryDefinition="(field["Project"] = "/Projects/Release1")"
OR
im issues --queryDefinition="(field["Project"] = "/Projects/Release1")"
To list only segment items, the queryDefinition is
"((field["Project"] = "/Projects/Release1") and (item.segment))"
Note: The list of published commands for the API can be found in the Integrations Builder Guide. these are the commands that we guarantee to work and give expected responses in the API.
Information on specific commands (such as options, syntax, output) is found in the Online Help under the CLI Reference section.