python - 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
解决方案
我认为正确的州名是closed successful
,但您不需要同时发布名称和 ID,只需其中一个就足够了。
推荐阅读
- pointers - 符号表中“删除”的策略实现为具有“紧密嵌套范围规则”的语言的哈希表
- python - 代码没有按照我想要的方式工作(python)
- reactjs - ReactJS - 在 iPhone 框架中呈现我的网站
- python - 使用 FastAPI 的嵌套 Pydantic 模型返回错误:必填字段 (type=value_error.missing)
- c++ - 为什么我会收到错误“malloc():损坏的顶部大小”?
- javascript - 使用 axios 在单独的文件中上传文件的进度
- javascript - 历史推送是按两次相同的键
- apache-kafka - 无法在 Azure 事件中心启用 Kafka 功能
- c++ - 这是带有 C++20 概念的 gcc 11 编译器错误,还是我做错了什么?
- powershell-core - PowerShell 中的空条件运算符有什么意义?