cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti Rest end point

narranil2
Champ in-the-making
Champ in-the-making
Hi,

I've defined the Activiti rest end point through Spring boot Rest controller under com.activiti.extension.rest package in enterprise edition of Activiti.

Once I try to configure this end point and use it in Activiti process I'm getting 401-Access denied error.

But once I login to Activiti enterprise and use this rest end point URL in browser I'm getting results. I've passed the authentication info also.

Please suggest me if I'm doing anything wrong. Sinnet of the code is attached.

@RestController("AccountController")
@EnableAutoConfiguration
@RequestMapping({"/account"})
public class AccountRestController {

@RequestMapping(value={"/currencies"}, method=RequestMethod.GET, produces = "application/json")
   public Set<Currency> getAllCurrencies() {
      Set<Currency> aCurrencySet = Currency.getAvailableCurrencies();

      System.out.println("Available currencies:::"+aCurrencySet.size());

      for (Currency currency : aCurrencySet) {

         System.out.println("Currency Code::::"+ currency.getCurrencyCode());
      }
      return aCurrencySet;
   } 
}

http://localhost:8080/activiti-app/app/account/currencies

Thanks,
Anil
5 REPLIES 5

abbask
Champ on-the-rise
Champ on-the-rise
1.) remove @EnableAutoConfiguration - not required.
2.) you don't need to provide authentication for  `com.activiti.extension.rest` as it is used by UI and takes auth from cookies.
3.) try it directly in a drop down Rest call. instead of saving it first. also, i think you should send <java>org.simple.JSONObject</java> as reponse.

narranil2
Champ in-the-making
Champ in-the-making
Still I am not able to call the rest end point directly under the the drop down list.It's saying un authorized.

Request URL: http://localhost:8080/activiti-app/app/account/listContractEntities
Response code: 401
Response message: Unauthorized

cjose
Elite Collaborator
Elite Collaborator
How are you passing the authentication information in your request? Can you paste your HTTP Request Headers here?

Ciju

narranil2
Champ in-the-making
Champ in-the-making
Thanks for the reply.I'm able to figure it out.Do you have any sample example on how to use formkey to invoke external UI form in activiti BPM process?

cjose
Elite Collaborator
Elite Collaborator