Add new version of an existing document in wrkfront through api - workfront-api

I am workg on a workfron project where I am able to create a new folder and a new document where that document has been created with version v.1 and placed into that folder. Now I want to create a new version of that existing document through api call. Thanks.

It is hard to figure it out from their documentation.
To upload a new version of document in Workfront trough API you need to first upload it with a call to attask/api/v13.0/upload (WF documentation is ok for this, and you got this working you said)
Then POST call to DOCV and pass updates: handle from upload call, documentID and fileName.
attask/api/v13.0/DOCV?updates={"handle":"DOCUMENT-HANDLE","documentID":"DOCUMENT-GUID","fileName":"FOO.png"}
I hope that helps. :P

Related

What values to use for linkExternalObject action on project object?

I'm trying to link external folder using Workfront API (v12) using linkExternalObject action on a project.
According to Api Explorer it takes 5 arguments:
objID (string)
linkedObjectID (string)
integrationType (string)
URL(string)
params (string[])
This action is also described in Developer Documentation, but that doesn't help much.
I'm assuming that:
objID will be id of a folder (DOCFDR) that I can create using api.
integrationType should be WEBHOOKS, since I'm integrating with external storage via document webhooks.
Any idea if it's correct way to create a linked folder and where to take the remaining values from?
I tried creating Linked Folder (LNKFDR) directly, but it's not a top level object so I can't.
I tried looking up values for Linked Folder created via Workfront UI but that doesn't help much.
linkExternalObject action as documented in Api Explorer
Any help will be greatly appreciated.

2sxc - copy app to new folder and name

I created my "base" app which I plan to use for a different little-changed app with different views and additional fields.
What is the right and easiest way to make a copy of this base app to different name and folder?
Also can than that apps work side by side on one portal?
=== edit 1 ===
I already try to rename app like in this post: 2sxc : Rename App Folder
Then create a new export of entire app, and restore portal to version before rename and try to import this "new" renamed app. But get the error...
Now I am looking to exported App.xml and there are "EntityGUID" and "AttributeSet StaticName" and "App Guid" with GUID values and I think that this is a problem at importing this "new" app...
Is it possible that I make a tool to parse this XML find all GUID-s then generated the same number of new GUID-s and replace old ones with new ones and repack ZIP and then try to import this? Can this be a solution or this is totally wrong?
I make an app : https://github.com/pircjernej/NajdiNET.2sxc.Rename
If you build it or download exe from the release you can change Exported app ZIP file to new name and folder... Then just install this changed zip and do what you want...
Now work for my sample 2sxc app but did not test how to work with 2sxc sample apps... I will do this in next days...
If someone wants to test it help or contribute, you are welcome.
==== edit 1 =====
I make quick test with 2sxc blog app and I think that work OK

how to create a new folder using alfresco api

I have uploaded sample.zip file in this directory CompanyHome/site/testsite/documentlibrary/test.
Now I want to create new folder called childfolder under above directory [CompanyHome/site/testsite/documentlibrary/test/childfolder] and move the sample.zip under it.using Alfresco API how do i create child folder and move the file under newly created childfolder?
This really depends upon what version of Alfresco you're using and what API you want to use to do it. For example, assuming that you want to do this via a REST API then you have the option of CMIS, the recent "Public API" or the internal WebScript based API.
Alternatively, you might want to do this by using the JavaScript API and WebScript develop your own WebScripts.
There are lots of ways to achieve this - perhaps you can provide some more information on the overall picture of what you're trying to do and where you're trying to do this (e.g. as an extension of Share maybe?).
It's possible to create a folder within Share and if you do so whilst you have browser developer tools open you'll be able to see the exact REST API calls that are used.

How to delete existing version history of a node and create new versionHistory with latest updated node properties in alfresco

I am trying to delete the complete version history of a node and creating a new version history with latest updated node properties, but it seems this is not going through.
Following is the code from alfresco javascript webscript:
promoVersionDeleter.deleteVersionHistory(node);
node.createVersion("Marking promotion as new version",true);
Here promotionVersionDeleter is a bean configured in webscript-context.xml to inject java webscript function in jsScript.
New version history is getting created with node.createVersion, but this is not having latest updated data.
Please suggest.

How to write a webscript in Alfresco that returns a zip file

I need to write a webscript in alfresco that returns to the user a single zip file that contains several files, some of them created on the fly by the script and some of them stored on the server.
How can i do it?I know how to create different files on the server, i don't know how to zip them and how to include files that are stored on the server.
Well, you can develop a Java action that would do the zipping part.
Last time I was looking into this, I didn't find an out-of-the-box solution.
As for returning, you can specify that by specifying webscript format, ie:
<format default="html">any</format>
Only, there is a problem, you can't set a zip format, but alfresco wiki says how you can add more:
http://wiki.alfresco.com/wiki/3.0_Web_Scripts_Framework#HTTP_Response_Formats
Edit: I just found this thread (while looking for a solution for another problem). In the thread a custom "unzip" action is described, maybe you can use that to add a zip/unzip action in your alfresco installation and use it.

Resources