cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

C# API Getting the Segment ID after using createSegment

SOLVED
Highlighted
Bedrock

C# API Getting the Segment ID after using createSegment

how do I, using C# API, get the Segment ID after using createSegment function

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: C# API Getting the Segment ID after using createSegment

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. 

View solution in original post

5 REPLIES 5
Highlighted

Re: C# API Getting the Segment ID after using createSegment

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:

  • http://<hostname>:<port>/documentation/javadocs/capi/mksCommand_8h.html
  • http://<hostname>:<port>/documentation/javadocs/capi/mksResponse_8h.html

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.

Highlighted

Re: C# API Getting the Segment ID after using createSegment

one more question.....Is there a API comand to get a list of all the projects available?

Highlighted

Re: C# API Getting the Segment ID after using createSegment

"im projects" will give you a list of projects.

Highlighted

Re: C# API Getting the Segment ID after using createSegment

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

Highlighted

Re: C# API Getting the Segment ID after using createSegment

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. 

View solution in original post

Announcements