cancel
Showing results for 
Search instead for 
Did you mean: 

WebScript 404s

steine
Champ in-the-making
Champ in-the-making
I've encountered at least a couple of Web Scripts calls that are giving me 404s.

http://localhost:8080/alfresco/service/api/types
06030020 Script url /api/types does not map to a Web Script.

http://localhost:8080/alfresco/service/api/checkedout
06030019 Script url /api/checkedout does not map to a Web Script.

Both are GET calls from a Firefox browser. My reading of the API suggests that those should both be valid calls. Does anyone know why they might be failing?

There may be more .. I haven't checked exhaustively. Other calls are working as expected, such as
http://localhost:8080/alfresco/service/api/sites
http://localhost:8080/alfresco/service/api/people


Thanks,
Eric Stein
8 REPLIES 8

afaust
Legendary Innovator
Legendary Innovator
Hello,

there is no web script that is mapped to a GET request on /api/types or /api/checkedout in a standard Alfresco (checked 4.1 Enterprise and 4.2 Community), so the 404s are very much expected and correct.
Which API did you read that suggested these to be valid URIs?

Regards
Axel

steine
Champ in-the-making
Champ in-the-making
http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Checked-out_Documents_.28getCheckedou...

has a sample URL towards the bottom of the entry. I'm using 4.1.3 Enterprise.

steine
Champ in-the-making
Champ in-the-making
Okay, I just found http://localhost:8080/alfresco/service/index/uri/

Is that the list of actual API calls that's available? It seems to have multiple serious discrepancies with the documentation .. is that right?


Making things more fun, at least one of the calls it looks like I want to make (/cmis/checkedout) is listed as deprecated, but there's no indication as to what call I should be making instead. Is there a cookbook that I'm missing that shows the expected usage of the API for basic document management functions?

Thanks,
Eric

afaust
Legendary Innovator
Legendary Innovator
The wiki page you took the information from refers to a previous version of Alfresco - that's why the API has changed.

All /cmis/* services should really be called with a proper CMIS client - only if you really, really want to do the low-level handling of CMIS would you do that yourself. The /cmis/* methods are deprecated because Alfresco switched from a proprietary CMIS server-side implementation to OpenCMIS and /cmis/* is the old API which shouldn't be used much longer.

/service/index/uri is the list of actual ReST API calls available by the Alfresco Repository via the Web Scripts framework - there are other APIs available provided by different frameworks within the same Repository (i.e. the /cmisatom/ provided by OpenCMIS). As you have seen, each ReST API states in its lifecycle if it may be considered public API and is stable enough between releases for use by clients.
My advice: Use CMIS on /cmisatom/ for your basic document management function needs. With CMIS, there is no need to talk to a proprietary API (which the ReST API can be considered as) for basic functions. For CMIS, you don't need to know the exact endpoints for each operation, as the CMIS protocol itself handles discovery of functional endpoints, i.e. the server tells you which URI to call for a specific operation on a specific piece of content. Simply point your CMIS client to /alfresco/cmisatom (or /alfresco/cmis for the old API).

Regards
Axel

Regards
Axel

hmarzan
Champ in-the-making
Champ in-the-making
Hi guys at Alfresco.

I'm new to this product. I'm actually trying to integrate it.

I'm developing a client app, which consumes both the OpenCMIS api for folder and content, and the RESTFul API for the discussion/forum services, which I enumerate next:

GET /alfresco/service/api/forum/node/{store_type}/{store_id}/{id}/posts
GET /alfresco/service/api/forum/node/{store_type}/{store_id}/{id}/posts/hot
GET /alfresco/service/api/forum/node/{store_type}/{store_id}/{id}/posts/myposts
GET /alfresco/service/api/forum/node/{store_type}/{store_id}/{id}/posts/new?numdays={numdays}

GET /alfresco/service/api/forum/discussions/posts/filtered

<strong>Sample:</strong>

http://alfrescosrv:8080/alfresco/service/api/forum/node/workspace/SpacesStore/f3040f74-a949-4dbf-b5d...

http://alfrescosrv:8080/alfresco/service/api/forum/node/workspace/SpacesStore/f3040f74-a949-4dbf-b5d...

http://alfrescosrv:8080/alfresco/service/api/forum/discussions/posts/filtered

where workspace://SpacesStore/f3040f74-a949-4dbf-b5de-018c23fdae45 is the actual folder or content, with an existing forum created in it using alfresco explorer.

All of these apis above <strong>always throws the same empty result</strong>, but I actually have forums (topics and replies) on them. This is what I get all the time for the mentioned apis:

{
   "forumPermissions":
   {
      "create": true,
      "edit": true,
      "delete": true
   },
   "total": 0,
   "pageSize": 1000,
   "startIndex": 0,
   "itemCount": 0,
   "items":
   [
   ]
}

Also, you can see from the following call, that this nodeRef actually have posts and replies:

http://alfrescosrv:8080/alfresco/service/collaboration/forumSummary?nodeRef=workspace://SpacesStore/...

—–BEGIN HTLM RENDERED CONTENT —–
<strong>
3 posts in the last 7 days
2 new topics in the last 7 days
</strong>
—–END HTLM RENDERED CONTENT —–

I other cases, I get 404s when trying to retrieve the forums from a specific node.

Is there any way to retrieve the forums from a specific nodeRef of a folder or content ?

Also, I tried the apis on existing topics and I get results. Examples:

http://alfrescosrv:8080/alfresco/service/api/forum/post/node/workspace/SpacesStore/598a9547-8e06-47b...
http://alfrescosrv:8080/alfresco/service/api/forum/post/node/workspace/SpacesStore/598a9547-8e06-47b...

where workspace://SpacesStore/598a9547-8e06-47bc-b91d-cc154d88c6e6 is the topic.

<strong>WHAT DO I WISH TO ACHIEVE WITH THIS API?</strong>

Given an Alfresco nodeRef for a Folder or Content, to Retrieve first the Forums in it, and finally the Topics and Replies.

And also be able to add new topics, and replies from the client app, for the currently retrieved forum nodeRef.

Is that possible from the RESTFul API?
Is there any other way to do this, like for example using <strong>OpenCMIs and the Forum Model </strong>? Is there an example for using OpenCMIs with the Forum Model?

<strong>Is there a Forum API which I could use from C# and .NET ? </strong>

Any help would be appreciated.


Regards and Thanks in Advance.


Harold.



kaynezhang
World-Class Innovator
World-Class Innovator
Yes ,you can implement your requirements using  RESTFul API.in your case empty result is returned,I guess there must be something wrong with your code .following is my test ,it works fine.

{
   "forumPermissions":
   {
      "create": true,
      "edit": true,
      "delete": true
   },
   "total": 1,
   "pageSize": 1000,
   "startIndex": 0,
   "itemCount": 1,
   "items":
   [
{
   
      "name": "post-1378539549975_8476",
      "totalReplyCount": 1,
         "lastReplyOn": "2013-09-08T15:15:57.084+08:00",
   "lastReplyBy":
   {
      "username": "admin",
      "firstName": "Administrator",
      "lastName": ""
   },
      "tags": [],
      "site": "",

   "url": "/forum/post/node/workspace/SpacesStore/59111988-cc0d-4164-b3ca-f0f7eb0409db",
   "repliesUrl": "/forum/post/node/workspace/SpacesStore/59111988-cc0d-4164-b3ca-f0f7eb0409db/replies",
   "nodeRef": "workspace://SpacesStore/59111988-cc0d-4164-b3ca-f0f7eb0409db",
   
   "title": "furum",
   "createdOn": "2013-09-07T15:39:10.159+08:00",
   "modifiedOn": "2013-09-07T15:39:10.159+08:00",
   "isUpdated": false,  
   "author":
   {
      "username": "admin",
      "firstName": "Administrator",
      "lastName": ""
   },
      "content": "<p>sssssssssss<\/p>",
   "replyCount": 1,
   "permissions":
   {
      "edit": true,
      "reply": true,
      "delete": true
   }
}
     
   ]
}




If you just want to read topics and posts information ,you can use cmis api(also of course c# and .net). But if you want create topics and posts ,using cmis api operating on forum model directly will not work,because there are some overhead in alfresco forum implementation(for example create unique post name,generate tag) than just creating node of type forum.

hmarzan
Champ in-the-making
Champ in-the-making
The problem is that when I try to retrieve the Forums, Topics and Posts from a content or folder, always comes empty.

If I try the same urls on a Topic or Post ID, it outputs data similar to yours, but what I want is to retrieve the discussions in a specific folder or document.

I want to get those data of topics and posts, for a selected folder or file.


Regards,


Harold.

kaynezhang
World-Class Innovator
World-Class Innovator
A document/folder 's discussion is saved as child associations to the it's node.forum webscript api (/alfresco/service/api/forum/node)dose not seemt to support
getting disccussion information for a specific folder or document.
As far as I know there is no existing web scripts that handle this kind of discussion  except you develop your own custom web script