Trying to check out Doc with Rest api

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2009 04:59 PM
Alright, I am using the following to check out a file from the api. It returns the atom/xml but doesn't checkout the doc.
GetMethod method = new GetMethod(
"http://<hostname>:<port>/alfresco/service/api/node/workspace/SpacesStore/48bd0658-1261-4b0a-a74c-3d57b8094208/checkedout");
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials("admin",
"admin");
client.getState().setCredentials(AuthScope.ANY, defaultcreds);
// Send POST request
int statusCode = client.executeMethod(method);
the api doc is limited. Any help would be appreciated.
GetMethod method = new GetMethod(
"http://<hostname>:<port>/alfresco/service/api/node/workspace/SpacesStore/48bd0658-1261-4b0a-a74c-3d57b8094208/checkedout");
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials("admin",
"admin");
client.getState().setCredentials(AuthScope.ANY, defaultcreds);
// Send POST request
int statusCode = client.executeMethod(method);
the api doc is limited. Any help would be appreciated.
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2009 05:56 PM
If you would like to use Web Services API you must invoke any WS API call with the right SOAP Header in the request.
Here you can see all the informations you need about SOAP Headers.
If you are developing in Java language, maybe you could try to use the Alfresco Web Service Client, this is the Web Service Java stub precompilated from Alfresco and you can download it here (here for Alfresco Labs project).
Using this client you don't need to create SOAP Headers but you need only to use the Content Manipulation Language (CML) to invoke your queries on the repository.
Hope this helps.
Here you can see all the informations you need about SOAP Headers.
If you are developing in Java language, maybe you could try to use the Alfresco Web Service Client, this is the Web Service Java stub precompilated from Alfresco and you can download it here (here for Alfresco Labs project).
Using this client you don't need to create SOAP Headers but you need only to use the Content Manipulation Language (CML) to invoke your queries on the repository.
Hope this helps.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2009 09:45 AM
I am trying to use the REST version not the SOAP version. But the documentation only says to do the following:
POST /alfresco/service/api/checkedout
Obviously you need to supply the id of the document you wish to checkout, so based on the format of other calls, it was reasonable to assume that the url would be
http://<hostname>:<port>/alfresco/service/api/node/workspace/SpacesStore/<id>/checkedout
This will return an atom-xml with some information and doesn't fail, but it does say that checkout is false and it was not checked out. So the question is, what is the proper url for the REST call? Is there an additional parameter that needs to be passed in?
Thank you
POST /alfresco/service/api/checkedout
Obviously you need to supply the id of the document you wish to checkout, so based on the format of other calls, it was reasonable to assume that the url would be
http://<hostname>:<port>/alfresco/service/api/node/workspace/SpacesStore/<id>/checkedout
This will return an atom-xml with some information and doesn't fail, but it does say that checkout is false and it was not checked out. So the question is, what is the proper url for the REST call? Is there an additional parameter that needs to be passed in?
Thank you
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2009 10:06 AM
Here's the script definition.
Create a private working copy of the object, copies the metadata and optionally content. It is up to the repository to determine if updates to the current version (not PWC) and prior versions are allowed if checked-out.<br>
<br>
Inputs:<br>
<br>
ID documentId: ObjectID of Doc Version to checkout<br>
<br>
Outputs:<br>
<br>
ID documentId: ObjectID of Private Working Copy<br>
Bool contentCopied<br>
<br>
Notes:<br>
<br>
It is repository-specific to determine the scope of visibility to the private working copy.<br>
Other users not in the scope of checkout will see the public (pre-checkout) version while those in scope will be able to work on the checked-out version.<br>
Copying content on checkout or not is repository-specific.<br>
CheckOut() may remove update permission on prior versions.<br>
CheckOut() on a non-document object will throw OperationNotSupportedException.<br>
Some repositories may not support updating of private working copies and the updates MUST be supplied via checkIn().<br>
Create a private working copy of the object, copies the metadata and optionally content. It is up to the repository to determine if updates to the current version (not PWC) and prior versions are allowed if checked-out.<br>
<br>
Inputs:<br>
<br>
ID documentId: ObjectID of Doc Version to checkout<br>
<br>
Outputs:<br>
<br>
ID documentId: ObjectID of Private Working Copy<br>
Bool contentCopied<br>
<br>
Notes:<br>
<br>
It is repository-specific to determine the scope of visibility to the private working copy.<br>
Other users not in the scope of checkout will see the public (pre-checkout) version while those in scope will be able to work on the checked-out version.<br>
Copying content on checkout or not is repository-specific.<br>
CheckOut() may remove update permission on prior versions.<br>
CheckOut() on a non-document object will throw OperationNotSupportedException.<br>
Some repositories may not support updating of private working copies and the updates MUST be supplied via checkIn().<br>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2009 10:13 AM
Yes, but then it has below that:
POST /alfresco/service/api/checkedout
Requirements:
* Default Format: atomentry
* Authentication: user
* Transaction: required
* Format Style: any
Definition:
* Id: org/alfresco/repository/store/checkedout.post
* Description: classpath:alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.desc.xml
POST /alfresco/service/api/checkedout
Requirements:
* Default Format: atomentry
* Authentication: user
* Transaction: required
* Format Style: any
Definition:
* Id: org/alfresco/repository/store/checkedout.post
* Description: classpath:alfresco/templates/webscripts/org/alfresco/repository/store/checkedout.post.desc.xml
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2009 11:07 AM
Have you tried posting some atom to this script? Looking at the code, i'm fairly sure that you do not specify the ID on the URL.
And the code you started with is doing a GET not a POST.
And the code you started with is doing a GET not a POST.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2009 11:28 AM
I switched to a post and I am told with that URL that the Post method is not supported, even though the scripts exist for it.
