首页 > 解决方案 > Python - OTRS REST/SOAP API - python-otrs

问题描述

使用诸如python-otrs或 pyotrs 之类的 rest/soap API 可以关闭工单吗?

使用 python-otrs 我尝试收到错误:

otrs.client.SOAPError: TicketUpdate: Ticket->StateID or Ticket->State parameter is invalid! (TicketUpdate.InvalidParameter)

我尝试的代码是:

from otrs.ticket.template import GenericTicketConnectorSOAP
from otrs.client import GenericInterfaceClient
from otrs.ticket.objects import Ticket, Article, DynamicField, Attachment

server_uri = r'https://www.example.com'
webservice_name = 'GenericTicketConnectorSOAP'
client = GenericInterfaceClient(server_uri, tc=GenericTicketConnectorSOAP(webservice_name))

# user session
client.tc.SessionCreate(user_login='user', password='pass')

t_upd = Ticket(State='closed',StateID='3')
client.tc.TicketUpdate(3657,ticket=t_upd)

其中 3657 是票证的 ID。

谢谢,jp

标签: pythonpython-3.xsoapotrs

解决方案


我认为正确的州名是closed successful,但您不需要同时发布名称和 ID,只需其中一个就足够了。


推荐阅读