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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

"im editissue" is not working using Java APIs.

ghole
1-Visitor

"im editissue" is not working using Java APIs.

Hi, I am updating an Item using java program but getting "null" response.

Please help me with below code.

Command cmd = new Command();

cmd.setApp(Command.IM);

cmd.setCommandName("editissue");

cmd.addOption(new Option("field", "\"" + value + "\""));

cmd.addSelection(issueId);

CmdRunner cr = getPTCDataSource();

Response response = cr.execute(cmd);

Result result = response.getResult();

It throws "CommandException" saying CommandException(null).

Generated query from the code: im editissue --field="Discussion=API Testing" -- 1234

Please assist.

Thanks,

Gajanan.

ACCEPTED SOLUTION

Accepted Solutions
LLawton
16-Pearl
(To:ghole)

I haven't used the API in a while but I'm pretty sure the problem is with the line that contains "field"...

Firstly, the option to add is the command's full option, which in this case uses the syntax fielname = value.

Secondly, I believe you don't need the double quotes.

So your line should be something like that:

cmd.addOption( new Option( "some field name=some valid value for this field" );

Note that the double quotes are around the whole option, and that could have been stored in a string variable.

View solution in original post

2 REPLIES 2
LLawton
16-Pearl
(To:ghole)

I haven't used the API in a while but I'm pretty sure the problem is with the line that contains "field"...

Firstly, the option to add is the command's full option, which in this case uses the syntax fielname = value.

Secondly, I believe you don't need the double quotes.

So your line should be something like that:

cmd.addOption( new Option( "some field name=some valid value for this field" );

Note that the double quotes are around the whole option, and that could have been stored in a string variable.

ghole
1-Visitor
(To:LLawton)

Yes, you are right. Thank you!!

Announcements


Top Tags