Question when uploading unclassified document by RestAPI in Veeva Vault
AnsweredWe want to upload unclassified document to Veeva Vault by RestAPI.
There are totally 4 data formats involved in Veeva Vault REST API:
Json
Xml
x-www-form-urlencoded
multipart/form-data
We try to purposal on foramt“multipart/form-data”as below.
Could someone please help check if below format needs to be adjusted somewhere?
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="name__v";
myDocument
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="type__v";
Unclassified
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="lifecycle__v";
Inbox
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="file";filename="test.txt";
Content-Type: text/plain
666666,7,8,9
test1,1,2,3
test2,4,5,6
--SAPPO243fad9dc9db11ec85b50000003990ea--
Br, Louis Zhou
-
Official comment
Hi Louis,
When creating an Unclassified document, the file, type__v, and lifecycle__v body parameters are only allowed:
There is a subsection in our documentation specifically about creating Unclassified documents through the API:
https://developer.veevavault.com/api/22.1/#create-single-documentI would also recommend using our Postman collection to test as well. This is updated every release to include new platform API features:
https://developer.veevavault.com/api/22.1/#run-in-postman -
Hi Isak,
Thank you for your recommendation. I will refer to suggested API to upload document, i.e., https://developer.veevavault.com/api/22.1/#create-single-document.
I can use Postman to test the API. However, I am now planning to build the coding program in Java to integrate this API into our internal system. Before the integration, I want to confirm the request body on multipart/form-data format in java for our REST API. Could you please provide a help on this?
Please kindly refer to below and let me know if any correction is required. Thank you so much!
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="name__v";
myDocument
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="type__v";
Unclassified
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="lifecycle__v";
Inbox
--SAPPO243fad9dc9db11ec85b50000003990ea
Content-Disposition: form-data;name="file";filename="test.txt";
Content-Type: text/plain
666666,7,8,9
test1,1,2,3
test2,4,5,6
--SAPPO243fad9dc9db11ec85b50000003990ea--
0 -
Hi Louis,
First, I would strongly recommend using Vapil to help you build Vault API calls in Java. Here is the more information about that:
https://developer.veevavault.com/docs/#vault-api-libraryAs far as your API call, it looks fine to me from what I can tell. The main benefit of using the Postman collection is that you can test your parameters for your API call and then code it appropriately.
0
Please sign in to leave a comment.
Comments
3 comments