如何使用 Pentaho REST 删除文件 API
How to delete a file with the Pentaho REST API
我的 Pentaho REST API 一项功能正在正常工作:删除文件夹或文件,我尝试了这种语法和其他一些语法,但没有用:
PUT 方法:http://my-server/pentaho/api/repo/files/delete/public:basic.xml
我尝试更改方法 (DELETE) 和其他语法但没有任何效果
根据documentation你PUT
到:
/repo/files/delete
或
/repo/files/deletepermanent
与正文:
A comma-separated list of the files to be moved to the trash folder
或
A comma-separated list of the files to be deleted
您的 PUT 请求应该是:
http://servername.domain.com:8080/pentaho/api/repo/files/delete
并且在请求正文中,您需要放入已删除文件的 ID。
您可以通过以下方式获取此 ID:
http://servername.domain.com:8080/pentaho/api/repo/files/home/karp/ARCH/children?locale=en
答案将类似于:
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<repositoryFileDtoes>
<repositoryFileDto>
<aclNode>false</aclNode>
<createdDate>1579701212208</createdDate>
<fileSize>8923</fileSize>
<folder>false</folder>
<hidden>false</hidden>
<id>6f43abcc-0e05-4dbe-8bf9-fc383a9e7983</id>
<lastModifiedDate>1579701212208</lastModifiedDate>
<locale>pl</locale>
<localePropertiesMapEntries>
<locale>default</locale>
<properties>
<key>file.title</key>
<value>Ankieta_po</value>
</properties>
<properties>
<key>jcr:primaryType</key>
<value>nt:unstructured</value>
</properties>
<properties>
<key>title</key>
<value>Ankieta_po</value>
</properties>
</localePropertiesMapEntries>
<locked>false</locked>
<name>Ankieta_po.prpt</name>
<notSchedulable>false</notSchedulable>
<ownerType>-1</ownerType>
<path>/home/karp/ARCH/Ankieta_po.prpt</path>
<title>Ankieta_po</title>
<versionCommentEnabled>false</versionCommentEnabled>
<versionId>1.1</versionId>
<versioned>true</versioned>
<versioningEnabled>false</versioningEnabled>
</repositoryFileDto>
</repositoryFileDtoes>
所以,您的请求应该如下所示(来自 Postman):
enter image description here
我的 Pentaho REST API 一项功能正在正常工作:删除文件夹或文件,我尝试了这种语法和其他一些语法,但没有用:
PUT 方法:http://my-server/pentaho/api/repo/files/delete/public:basic.xml
我尝试更改方法 (DELETE) 和其他语法但没有任何效果
根据documentation你PUT
到:
/repo/files/delete
或
/repo/files/deletepermanent
与正文:
A comma-separated list of the files to be moved to the trash folder
或
A comma-separated list of the files to be deleted
您的 PUT 请求应该是:
http://servername.domain.com:8080/pentaho/api/repo/files/delete
并且在请求正文中,您需要放入已删除文件的 ID。
您可以通过以下方式获取此 ID:
http://servername.domain.com:8080/pentaho/api/repo/files/home/karp/ARCH/children?locale=en
答案将类似于:
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<repositoryFileDtoes>
<repositoryFileDto>
<aclNode>false</aclNode>
<createdDate>1579701212208</createdDate>
<fileSize>8923</fileSize>
<folder>false</folder>
<hidden>false</hidden>
<id>6f43abcc-0e05-4dbe-8bf9-fc383a9e7983</id>
<lastModifiedDate>1579701212208</lastModifiedDate>
<locale>pl</locale>
<localePropertiesMapEntries>
<locale>default</locale>
<properties>
<key>file.title</key>
<value>Ankieta_po</value>
</properties>
<properties>
<key>jcr:primaryType</key>
<value>nt:unstructured</value>
</properties>
<properties>
<key>title</key>
<value>Ankieta_po</value>
</properties>
</localePropertiesMapEntries>
<locked>false</locked>
<name>Ankieta_po.prpt</name>
<notSchedulable>false</notSchedulable>
<ownerType>-1</ownerType>
<path>/home/karp/ARCH/Ankieta_po.prpt</path>
<title>Ankieta_po</title>
<versionCommentEnabled>false</versionCommentEnabled>
<versionId>1.1</versionId>
<versioned>true</versioned>
<versioningEnabled>false</versioningEnabled>
</repositoryFileDto>
</repositoryFileDtoes>
所以,您的请求应该如下所示(来自 Postman):
enter image description here