繁体   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