return response back from process model

HI All,

 

here is the requirement:

 

we need to create a REST service which receives some input parameters and based on input parameters response need to return. But, here response is given by a user not any rule or query entity. This service will be used from external source. So whenever external source will hit the service it will expect some response.

 

I created a process model for this and assigned task to user for the response. In the web api i started this process model by using a!startprocess . web api only initiate the process model but not wait for completion as its(a!startprocess) property but i need response back from user .

How can i do this? any suggestion would be appreciated.

 

Thanks in advance.

 

Regards

Abhay  

  Discussion posts and replies are publicly visible

  • Hi Abhay,
    You need to have 2 REST services in this scenario , one which will create a task for the user and other will take the user response and submit to the external system.

    Thanks
    Manish
  • Thanks for reply manish,

    but how second service will reply to external system because we can only invoke the appian service when user/external system will submit the input after that session will expire . Then after that how you can send the response without any request. please make me wrong if i am saying anything wrong.
  • Hi Abhay ,

    Your main Idea is to capture a user response , So when you create a task for user , you need to add some identifier in appian which will be passes down to other system , for example . If Some external service wants the user to submit his details , So when you create the job for user , you have to make the user ID as identifier and when user submit the request from Appian , the same will be passed to the external system which will identify the response for which request Id.

    I am not sure the same suits you becoz you mentioned for session , if you think that user will respond in the same session than I do not think its possible . But with the 2 service approach it is quite possible .
  • If the user involved you can't have it as one call to your REST service because the response can be ready at unknown time. So you need to first have a call that initiates process and it should assign some id and return it to the user.

    To get the result you have two options: one is the client should pull your service periodically until it is ready or provide a callback method that your process will call when user done with his task.
  • The main reason is that the startProcess start the process asynchronous, so you will never regret be able to do that.

    But the approach suggested is a good one, create an id insert it in a table, when the user answer put the answer in the table, and give certain status to that table.

    Create a second test service to query that information, after certain time( this is trying to simulate the sync that you want)

    Be careful with the polling time because you can insert lot of queries to appian when doing that from a different system.

    There are another more complicated ways to give the response back to the external systems like emails, jms or writing directly to your external DB, I am not sure if you want to start messing with those options.

    Best regards
    José