簡體   English   中英

向Liferay JSON API提交REST請求時發生未知錯誤

[英]Unknown error when submit a REST request to Liferay json API

我正在用Python編寫腳本,以自動更新Liferay門戶中的結構,我想通過JSON REST API進行操作。

我請求獲取一個結構(方法getStructure),並且它起作用了。

但是,當我嘗試在門戶中進行結構更新時,會顯示以下錯誤:

ValueError: Content-Length should be specified for iterable data  
of type class 'dict' {'serviceContext': "{'prueba'}", 'serviceClassName':
'com.liferay.portlet.journal.service.JournalStructureServiceUtil', 'name': 'FOO',
'xsd': '... THE XSD OBTAINED VIA JSON ...', 'serviceParameters':
'[groupId,structureId,parentStructureId,name,description,xsd,serviceContext]',
'description': 'FOO Structure', 'serviceMethodName': 'updateStructure',
'groupId': '10133'}

我在做什么是下一個:

urllib.request.Request(url = URL, data = data_update, headers = headers)

網址為http:// localhost:8080 / tunnel-web / secure / json
標頭使用基本身份驗證進行配置(它可以正常工作,並使用getStructure方法進行了測試)。
數據是:

data_update = {
"serviceClassName" : "com.liferay.portlet.journal.service.JournalStructureServiceUtil",
"serviceMethodName" : "updateStructure",
"serviceParameters" : "[groupId,structureId,parentStructureId,name,description,xsd,serviceContext]",
"groupId" : 10133,
"name" : FOO,
"description" : FOO Structure,
"xsd" : ... THE XSD OBTAINED VIA JSON ...,
"serviceContext" : "{}" }

有人知道解決方案嗎? 我需要指定字典的長度嗎? 還是這是一個錯誤?

可能對您有幫助。 看來這是python的錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM