How add/remove a task from the hidden tab using the REST API? It is not clear in the docs how to achieve this.
In order to hide a task, you can do a POST on:
http://localhost:8080/bonita/API/bpm/hiddenUserTask/
with:
{“user_id”:“12”,“task_id”:“32”}
where you should use your own user_id and task_id.
And to unhide a task, you can do a DELETE on:
http://localhost:8080/bonita/API/bpm/hiddenUserTask/12/32
with:
{“user_id”:“12”,“task_id”:“32”}
using your own user_id and task_id.
OK thanks.
I am getting the following error:
REQUEST
Remote Address:127.0.0.1:8084 Request URL:http://localhost:8084/bonita/API/bpm/hiddenUserTask Request Method:POST Status Code:500 Internal Server Error Request Headersview source Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip, deflate Accept-Language:en-GB,en-US;q=0.8,en;q=0.6 Cache-Control:no-cache Connection:keep-alive Content-Length:35 Content-Type:application/json; charset=UTF-8 Cookie:JSESSIONID=6B6C83FD976913BF56EA2AE3C161A78F; BOS_Locale=en Host:localhost:8084 Origin:http://localhost:4200 Pragma:no-cache Referer:http://localhost:4200/dashboard User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36 Request Payloadview source {user_id: "103", task_id: "20003"} task_id: "20003" user_id: "103" Response Headersview source Access-Control-Allow-Credentials:true Access-Control-Allow-Origin:http://localhost:4200 Cache-Control:no-cache,no-store,no-transform,max-age=0 Connection:close Content-Type:application/json;charset=UTF-8 Date:Wed, 10 Dec 2014 04:26:31 GMT Expires:09 Dec 2014 04:26:32 GMT Pragma:No-cache Server:Apache-Coyote/1.1 Transfer-Encoding:chunked Vary:Origin
RESPONSE
{"exception":"class org.bonitasoft.web.toolkit.client.common.exception.api.APIException","message":"org.bonitasoft.engine.exception.UpdateException: USERNAME=helen.kelly | Error while trying to hide tasks: [20003] from user with ID 103","stacktrace":"[org.bonitasoft.web.rest.server.datastore.bpm.flownode.HiddenUserTaskDatastore.add(HiddenUserTaskDatastore.java:104), org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:69), org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:37), org.bonitasoft.web.rest.server.framework.API.runAdd(API.java:157), org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:188), org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188), javax.servlet.http.HttpServlet.service(HttpServlet.java:643), org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75), javax.servlet.http.HttpServlet.service(HttpServlet.java:723), org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:163), com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:237), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103), org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293), org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861), org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606), org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489), java.lang.Thread.run(Thread.java:745)]","cause":{"exception":"class org.bonitasoft.engine.exception.UpdateException","message":"USERNAME=helen.kelly | Error while trying to hide tasks: [20003] from user with ID 103","stacktrace":["org.bonitasoft.engine.api.impl.ProcessAPIImpl.hideTasks(ProcessAPIImpl.java:5105)","sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)","sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)","java.lang.reflect.Method.invoke(Method.java:606)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)","org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)","org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:276)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)","org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)","com.sun.proxy.$Proxy17.hideTasks(Unknown Source)","org.bonitasoft.web.rest.server.datastore.bpm.flownode.HiddenUserTaskDatastore.add(HiddenUserTaskDatastore.java:97)","org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:69)","org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:37)","org.bonitasoft.web.rest.server.framework.API.runAdd(API.java:157)","org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:188)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)","javax.servlet.http.HttpServlet.service(HttpServlet.java:643)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)","javax.servlet.http.HttpServlet.service(HttpServlet.java:723)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:163)","com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:237)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)","org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)","org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)","org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)","org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)","org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)","org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)","org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)","org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)","org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)","java.lang.Thread.run(Thread.java:745)"],"cause":{"exception":"class org.bonitasoft.engine.core.process.instance.api.exceptions.STaskVisibilityException","message":"Task with id 20003 is already hidden","stacktrace":["org.bonitasoft.engine.api.impl.transaction.flownode.HideTasks.execute(HideTasks.java:55)","org.bonitasoft.engine.api.impl.ProcessAPIImpl.hideTasks(ProcessAPIImpl.java:5103)","sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)","sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)","java.lang.reflect.Method.invoke(Method.java:606)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)","org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)","org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:276)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)","org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)","org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)","com.sun.proxy.$Proxy17.hideTasks(Unknown Source)","org.bonitasoft.web.rest.server.datastore.bpm.flownode.HiddenUserTaskDatastore.add(HiddenUserTaskDatastore.java:97)","org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:69)","org.bonitasoft.web.rest.server.api.bpm.flownode.APIHiddenUserTask.add(APIHiddenUserTask.java:37)","org.bonitasoft.web.rest.server.framework.API.runAdd(API.java:157)","org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:188)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)","javax.servlet.http.HttpServlet.service(HttpServlet.java:643)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)","javax.servlet.http.HttpServlet.service(HttpServlet.java:723)","org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:163)","com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:237)","org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)","org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)","org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)","org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)","org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)","org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)","org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)","org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)","org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)","org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)","org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)","org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)","java.lang.Thread.run(Thread.java:745)"]}},"api":"bpm","resource":"hiddenUserTask"}
Any ideas why?
Ah, I know why. The humanTask list I have is not filtering out hidden tasks and the task was already hidden. How to I get non-hidden tasks only? Currently I am doing:
http://localhost:8084/bonita/API/bpm/humanTask?c=10&p=0&f=state%3Dready&o=dueDate+DESC
but it appears this includes hidden tasks.
You need to add a filter for your user, for example:
&f=user_id%3d4