我正在尝试使用文档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也是正确的。我已多次检查但仍然没有得到任何解决方案。请给我解决方案。
谢谢
答案 0 :(得分:2)
Updating A Document上的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中的实际保险柜和文档ID以保持该数据的私密性,但如果没有,那么这将是您的错误。插入实际的Vault和Document ID来代替那些要继续前进的字符串。