Service Desk Practitioners Forum
cancel

Web-api:

Highlighted
fh25163
Frequent Contributor.

Web-api:

Hi,

I'm developing a simple application to communicate with service desk via web-api, create new objects and update some parameters of existing ones, but updating changes causes me trouble. After loading the change like this:

ApiSDSession session = Manipulator.getServiceDeskSession(server, username, password);
IChangeHome changeHome = session.getChangeHome();
IChange change = changeHome.openChange(changeID);

I fetch the requested status and try to update the change status and save updated change like this:

IStatusChangeHome statusHome = session.getStatusChangeHome();
IStatusChangeWhere statusWhere = statusHome.createStatusChangeWhere();
statusWhere.addContainCriteriumOnText(statusText);
IStatusChange[] statuses = statusHome.findStatusChange(statusWhere);

if(statuses!=null && statuses.length > 0)
change.setStatus(statuses[0]);
change.save();

However, when saving the change, I receive a Runtime Exception with this message:

"Program error: the attribute 'status.' of this change cannot be modified, because the change item was opened in view mode or because the attribute is read-only."

Change, that I'm trying to update is assigned to the same user that I use for logging to service desk. I also check the isModifyAllowed() property of the change and it returns true. After all this I also tried to update some other fields (description, information), but with the same result. Why is it, that I'm not able to edit change parameters? Or is there any way to open the change in other way than read-only.

Thanks in advance.
6 REPLIES
fh25163
Frequent Contributor.

Re: Web-api:

after closer inspection, I discovered that I'm not even able to edit parameters of workorders, which I previously created with the web-api. I must be missing something serious ... is there anything I can do woth this?
The Pike
Acclaimed Contributor.

Re: Web-api:

The fields in question are probably not active for the particular status code in which the Change is... or the Role has status range set so that the account you are using cannot edit the item in that particular status.

Points (and pints) for the guidance are welcome.

The Pike
fh25163
Frequent Contributor.

Re: Web-api:

Thanks for your reply but I think this might not be the problem, as the account I used is a standard one (not only for testing purpose) and its original owner uses it daily without problem with standard ovsd client. I also have access to another custom web-api application working with the same server and this is able to update the content of these fields with the account I'm using. Unfortunately, the application is only available in .jar without source code attached, so I can't see how it works. Could it be, that there is some inappropriate server configuration?
fh25163
Frequent Contributor.

Re: Web-api:

I mean that I'm not using any IWebApiApplication for my app, a that creating such application settings on the server would be able to solve the problem
fh25163
Frequent Contributor.

Re: Web-api:

So finally after lots and lots of investigation I found out, that there is a custom field specially related to status parameter of every entity, this field is automatically changed in the UI when status is change and vice versa. however, I didn't have access to the UI and I had only the original web-api.jar from the server admin, which also didn't know anything about the special field. Now, after rebuilding the api and changing both fields before saving the change, everything works fine :-) thank you all for your help ;-)
fh25163
Frequent Contributor.

Re: Web-api:

solution in previous reply. sorry