Prashant Bhosale
Prashant Bhosale

Reputation: 1

How to update document in TrueVault

I am trying to do update a document in TrueVault using document id and schema id but it gives me error like this

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

my encoded json is also correct. I have check it multiple times but still I have not get any solution. please give me solution.

Thank you

Upvotes: 0

Views: 311

Answers (1)

Dan Cleary - TrueVault
Dan Cleary - TrueVault

Reputation: 111

This request is described in TrueVault documentation on Updating A Document.

Your request needs to look something like this format:

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="

Try manually inputing this curl command on the command line using your information. A more descriptive error message will be a part of the response.

Note: I assume you replaced your actual Vault and Document IDs in this SO with vault-id and document-id to keep that data private, but if not then that would be your mistake. Insert the actual Vault and Document IDs in place of those strings to move on.

Upvotes: 2

Related Questions