2017-09-18 50 views
0

我想要使用一个Alfresco API,它返回存储在特定的Alfresco目录下的一些文档的信息。来自Alfresco的json多维数组

我的问题是,我正在得到的Json,当我试图返回例如cmis:name的值我得到一个未定义的错误。

我设法达到“属性”的水平,但我无法继续前进。你能告诉我吗?

预先感谢您。

success: function (json) { 

      $.each(json, function() { 
       $.each(this, function (key, value) { 
        console.log(value.object.properties); 
       }); 
       }); 
     }, 

enter image description here

回答

1

我发现进入最后一级的正确方法和得到值:

success: function (json) { 

      $.each(json, function() { 
       $.each(this, function (key, value) { 
        console.log(value.object.properties['cmis:name'].value); 
       }); 
       }); 
     }, 
0

没有你这样的查询:

http://localhost:8080/alfresco/s/example/cmis/query?format=json&q=select%20cmis:name,cmis:objectId%20from%20cmis:document%20where%20cmis:name%20=%27testwhitepaper%27

那么你将得到:

{"query": "select cmis:name,cmis:objectId from cmis:document where cmis:name ='testwhitepaper'", 
"results": [ 
{"name":"testwhitepaper", 
"id":"workspace://SpacesStore/9a007b6a-261a-4d6d-9e34-ded4430ba1ab;1.0" 
}, 
{"name":"testwhitepaper", 
"id":"workspace://SpacesStore/3356ff7d-4172-4bd5-a826-adfa541e6ad2;1.0" 
} 
] 
} 
+0

不,它是一个典型的ajax请求,我的网址是:url:'http://alfresco.companyname.com/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/网站/ ops-it/documentLibrary/Documentation/Intranet',我想获得该文件夹中文档名称的列表 – Wizeman1986