向Liferay json API提交REST请求时出现未知错误

2024-09-25 00:34:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用Python编写一个脚本来自动更新Liferay门户中的结构,我想通过json restapi来实现。在

我请求获取一个结构(methodgetstructure),它成功了。在

但是,当我尝试在门户中进行结构更新时,它会显示以下错误:

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'}

我要做的是下一步:

^{pr2}$

URL是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" : "{}" }

有人知道解决办法吗?我要指定这本词典的长度吗?怎么写?或者这是个虫子?在


Tags: namecomjsondata门户fooservicecontext