Web Service Update Ticket

Hi,

I want to build a webservice method for a workflow step that will update only the status of a ticket.  I built such a method, https://support.einsteinmed.edu/TDAdmin/EC907A1C-A5B8-423A-B989-B2165ED67FDF/2739/WebServiceMethods/Index/#/4387/edit, but it wiped out everything else.  Rather than have an attribute for every single field, is there a way to call out just the one field?  Here is the ticket in question:  https://support.einsteinmed.edu/TDNext/Apps/2739/Tickets/TicketDet?TicketID=26481715.

I repopulated all the fields, but you can see in the field what happened.  

Thanks,
Sheila

Asked by Sheila McBride on Thu 9/19/24 10:16 AM
Sign In to leave feedback or contribute an answer

Answers (2)

This answer has been marked as the accepted answer
Mark Sayers Thu 9/19/24 10:36 AM

Hello Sheila,

The best way to do this would be the ticket PATCH method. You can read about that here: https://support.einsteinmed.edu/TDWebApi/Home/section/Tickets#PATCHapi/{appId}/tickets/{id}?notifyNewResponsible={notifyNewResponsible}

And also here: https://support.einsteinmed.edu/TDWebApi/Home/AboutPatching

Sincerely,
Mark Sayers
Sr Support Consultant, CS

1 of 1 users found this helpful.
Thanks, Mark. I'll give it a try. - Sheila McBride Thu 9/19/24 10:36 AM
Hi Mark,

For https://support.einsteinmed.edu/TDAdmin/EC907A1C-A5B8-423A-B989-B2165ED67FDF/2739/WebServiceMethods/Index/#/4387/edit, here's what I have. Getting an error that it can't parse. Clearly I am missing something.

{"ID":-1,"Message":"patch must not be null. Errors:\r\n* Exception Message: The JsonPatchDocument was malformed and could not be parsed."}

{
"AppID":"2739",
"ID":"{{id}}",
"TypeID":"39260",
"FormID":"51958",
"Title":"{{Title}}",
"AccountID":"103874",
"StatusID":"{{StatusID}}",
"PriorityID":"6304",
"RequestorUid":"{{RequestorUid}}",

[
{op: "replace", path: "/StatusID", value: "128743"},

]
}
- Sheila McBride Thu 9/19/24 11:21 AM

Mark Sayers Thu 9/19/24 12:05 PM

That wouldn't be the correct formatting for a PATCH call. In a PATCH call, you just state the operation, path, and value of only the property or properties that the call is changing.

So just this part would be your call's Body:

[
{op: "replace", path: "/StatusID", value: "128743"},
]

No feedback
Perfect! It worked. Thanks.

In the article https://support.einsteinmed.edu/TDWebApi/Home/AboutPatching, it shows quotations around op, path, and value. Just in case that matters.
- Sheila McBride Thu 9/19/24 12:56 PM
I don't think it necessarily is needed in the PATCH call, but if it worked without them that is great. I normally do err on the side of just putting quotes around all my property names in a given API call. - Mark Sayers Thu 9/19/24 1:02 PM