Actions execution with Alfresco API Explorer

cancel
Showing results for 
Search instead for 
Did you mean: 
Fjordo
Active Member

Actions execution with Alfresco API Explorer

Hello to Everyone

I work on Alfresco 5.2 community edition,

I would like to use this api service https://api-explorer.alfresco.com/api-explorer/#!/actions/actionExec, but i can't reach it from my local environment.  If I call it from Postman I get 404 error, and I can't find it in my deployed Alfresco Api Explorer.war

In the link before it has been written "Note: this endpoint is available in Alfresco 5.2 and newer versions." and I'm using Alfresco 5.2, what am I missing?

Any suggests?

thanks

2 Replies
abhinavmishra14
Moderator
Moderator

Re: Actions execution with Alfresco API Explorer

Its expected, you have to deploy api-explorer.war to your alfresco instance that can connect to repository. 

Take a look at this documentation for more info: https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-install-api-explorer.html

https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest.html

The request you would be making from client would be like (e.g.):

POST http://<host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/action-executions

Request Body:
{
  "actionDefinitionId": "copy",
  "targetId": "4c4b3c43-f18b-43ff-af84-751f16f1ddfd",
  "params": {"destination-folder": "34219f79-66fa-4ebf-b371-118598af898c"}
}
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4=' -d '{
  "actionDefinitionId": "copy",
  "targetId": "4c4b3c43-f18b-43ff-af84-751f16f1ddfd",
  "params": {"destination-folder": "34219f79-66fa-4ebf-b371-118598af898c"}
}' 'http://<HOST>:<PORT>/alfresco/api/-default-/public/alfresco/versions/1/action-executions'

These apis should be working from client even without installing the api explorer as it is just an interface to play with available ReST APIs. 

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
Fjordo
Active Member

Re: Actions execution with Alfresco API Explorer

Thanks for responding me,

Maybe it was a bit confusing but, as said in my question, I called the api from Postman to my local environment, I've not used the "public" api-explorer URL.

The point of the question was I get 404 status when I call your url in my local env with Alfresco 5.2 community. Like action-executions API endpoint is not available.

Here is the call

localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/action-executions?alf_ticket={{alf_ticket}}

body:
{
    "actionDefinitionId": "copy",
    "targetId": "4c4b3c43-f18b-43ff-af84-751f16f1ddfd",
    "params": {
        "destination-folder": "34219f79-66fa-4ebf-b371-118598af898c"
    }
}

And here is the server response

 2021-05-19 12:26:42,692  ERROR [extensions.webscripts.AbstractRuntime] [http-bio-8080-exec-6] Exception from executeScript: 04190014 Unable to locate resource resource for :action-executions 
 org.alfresco.rest.framework.core.exceptions.NotFoundException: 04190014 Unable to locate resource resource for :action-executions 
	at org.alfresco.rest.framework.core.ResourceLookupDictionary.locateRelationResource(ResourceLookupDictionary.java:113)
	at org.alfresco.rest.framework.core.ResourceLookupDictionary.locateEntityResource(ResourceLookupDictionary.java:57)
	at org.alfresco.rest.framework.core.ResourceLookupDictionary.locateResource(ResourceLookupDictionary.java:152)
	at org.alfresco.rest.api.PublicApiDeclarativeRegistry.getResourceWithMetadataOrNull(PublicApiDeclarativeRegistry.java:263)
	at org.alfresco.rest.api.PublicApiDeclarativeRegistry.findWebScript(PublicApiDeclarativeRegistry.java:197)
	at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:165)
	at org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:82)
	at org.alfresco.rest.api.PublicApiWebScriptServlet.service(PublicApiWebScriptServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:75)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:132)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy226.doFilter(Unknown Source)
	at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

 

Do you know why?