0

我正在尝试使用文档 ID 和架构 ID 更新 TrueVault 中的文档,但它给了我这样的错误

Response Code : 400Exception in thread "main" 
java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.truevault.com/v1/vaults/vault-id/documents/document-id    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at TrueVaultGetRequest.sendPut(TrueVaultGetRequest.java:264)
    at TrueVaultGetRequest.main(TrueVaultGetRequest.java:140)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.truevault.com/v1/vaults/vault-id/documents/document-id
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at TrueVaultGetRequest.sendPut(TrueVaultGetRequest.java:260)
    ... 1 more

我编码的 json 也是正确的。我已经检查了很多次,但我仍然没有得到任何解决方案。请给我解决方案。

谢谢

4

1 回答 1

2

此请求在有关更新文档的 TrueVault 文档中进行了描述。

您的请求需要类似于以下格式:

curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000 \
    -u [API_KEY | ACCESS_TOKEN]: \
    -X PUT \
    -d "document=e30="

尝试使用您的信息在命令行上手动输入此 curl 命令。更具描述性的错误消息将成为响应的一部分。

注意:我假设您用 Vault-id 和 document-id 替换了此 SO 中的实际 Vault 和 Document ID,以保持该数据的私密性,但如果不是,那将是您的错误。插入实际的 Vault 和 Document ID 来代替这些字符串以继续。

于 2014-12-03T06:41:17.780 回答