Expand my Community achievements bar.

API Help - Uploading Document Versions

Avatar

Level 1

Has anyone had success uploading document versions through the API? I find the documentation on the API challenging at best and desperately need some help...

 

Long story short, our company has religiously linked files into Workfront via Box. We've just found out that out IT dept is moving our cloud storage from Box to sharepoint in the next 6 weeks and I need to ensure we don't lose our linked files. The best/most elegant solution I can come up with is to store all files locally as a new version of the linked files. This way we won't lose any comments or proofs that are currently available directly in our projects. 

 

My plan was to use fusion to listen for changes to projects over the next 6 weeks and, using the box connector, download the file and then re-upload. Unfortunately, fusion can only upload a file, not a new version unless I make a custom API call. This is where I got stuck. I did some googling and found a stack overflow conversation that suggests a post to this endpoint attask/api/v13.0/DOCV?updates={"handle":"DOCUMENT-HANDLE","documentID":"DOCUMENT-GUID","fileName":"FOO.png"}, but when I try it I get a 500 error.  Also, I would need to determine how to obtain the "handle" for the documents, which it does not appear is available when getting details on the document via api, nor is it available in platform.

 

Any help would be greatly appreciated! WE have about 50K+ files that we need to move. 

 

Thanks!

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Level 10

Hi Jeff,

 

As you are getting a 500 error there seems to be something wrong with the URL of your API call.

First I would change the API version to 17.0.

 

Besides that uploading a document or a document version is a 2-step process, as also written in the Stack Overflow post you linked:

 

1. Call the endpoint upload to upload the file and get a handle

2. Call the endpoint docu to assign the document to a Workfront object (Project, Task, ...)

or in your case

2. Call the endpoint docv to assign an additional version to an existing document

 

Your call to docv seems to be correct, but you need a handle first. This is not persistent, so you cannot read it from the database. It is created in response to the upload call and will be removed after a while.

 

Regards

Lars

Avatar

Level 1

Hi, I am having trouble with that first step of calling the upload endpoint and getting the handle back. I can't find the right notation or documentation about what I need to specify during the pass of my document to the url. I keep getting a 422 error back when I pass the following:

 

https://xxxxxxxxx.my.workfront.com/attask/api/v15.0/upload, along with my apiKey, a csv file, and content-type specification. Hoping I can get some help/advice on this, but let me know if you need any additional information to help me out. Appreciate any help! Thanks