<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web API to Process model integration</title><link>https://community.appian.com/discussions/f/integrations/12492/web-api-to-process-model-integration</link><description>Hi Folks, 
 
 I&amp;#39;m trying to achieve the following: 
 
 Create WebAPI for JSON request - this Web API accepts a JSON request 
 After accepting a JSON-type input - a process model is initiated to which this JSON value is passed 
 If the process initiation</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/70049?ContentTypeID=1</link><pubDate>Fri, 18 Oct 2019 18:09:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dd5334de-9828-467c-ae7d-ee13df95f17e</guid><dc:creator>aseemk0001</dc:creator><description>&lt;p&gt;Yes. Extracted the values from the request and assigned to Process parameter.&amp;nbsp;This way you can get the actual request in JSON format in to the process model. Sample below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Request :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Request&amp;quot;:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute1&amp;quot;:&amp;quot;value&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;payload&amp;quot;:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute2_1&amp;quot;:&amp;quot;value&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute2_2&amp;quot;:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute2_2_1&amp;quot;:&amp;quot;value&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute2_2_2&amp;quot;:&amp;quot;value&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;quot;Attribute3&amp;quot;:&amp;quot;value&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WebAPI:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;a!startProcess(&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;processModel:cons!PM_NAME,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; processParameters:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Attribute1:a!fromJson(http!request.body).Request.Attribute1,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;payload:a!toJson(a!fromJson(http!request.body).Request.payload)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/69461?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2019 12:39:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f294c936-b3ea-44e7-9d22-49f896924da6</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;It isn&amp;#39;t possible to create process variable of &amp;quot;Dictionary&amp;quot; or &amp;quot;Any Type&amp;quot;, so your best bet is to create a custom data type that matches the structure of this JSON request. Then, create a variable using that CDT and it will preserve the structure in your process variable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/69445?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2019 04:06:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:24c44684-2247-41e2-b86a-3e85457a1818</guid><dc:creator>sanjeetg891</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Did you find a way to have the format correctly in variable?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/61992?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 04:33:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:68d09957-9ee6-4941-aef2-a141f1f59521</guid><dc:creator>aseemk0001</dc:creator><description>Responding to an old thread as I ran in to a problem related to this.&lt;br /&gt;
&lt;br /&gt;
I have a Web API that accepts JSON request with few attributes. One of the attribute in the request is in JSON format and I ran in to issue while passing this value to process model. Below is the request format. &lt;br /&gt;
&lt;br /&gt;
&amp;quot;payload&amp;quot; attribute is mapped to a text variable in process model but the variable value is in dictionary format and not able to retrive each values from this variable (like Attribute2_2_1) in the process model.&lt;br /&gt;
&lt;br /&gt;
Is a there way I can retain the JSON format in process model variable ? I have already tried converting this to a JSON using a!toJson/a!fromJson but unable to convert the format. Thank you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{  &lt;br /&gt;
   &amp;quot;Request&amp;quot;:&lt;br /&gt;
   {  &lt;br /&gt;
      &amp;quot;Attribute1&amp;quot;:&amp;quot;value&amp;quot;,&lt;br /&gt;
      &amp;quot;payload&amp;quot;:&lt;br /&gt;
      {  &lt;br /&gt;
             &amp;quot;Attribute2_1&amp;quot;:&amp;quot;value&amp;quot;,&lt;br /&gt;
             &amp;quot;Attribute2_2&amp;quot;:&lt;br /&gt;
             {  &lt;br /&gt;
                      &amp;quot;Attribute2_2_1&amp;quot;:&amp;quot;value&amp;quot;,&lt;br /&gt;
                       &amp;quot;Attribute2_2_2&amp;quot;:&amp;quot;value&amp;quot;&lt;br /&gt;
              },&lt;br /&gt;
               &amp;quot;Attribute3&amp;quot;:&amp;quot;value&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Value in Payload variable on Process Model:&lt;br /&gt;
&lt;br /&gt;
[payload:[Attribute2_1:value, Attribute2_2:[Attribute2_2_1:value, Attribute2_2_2:value], Attribute3:value]]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/55584?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 10:42:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:48e86bc8-7c44-4a80-833f-7f40c80d1888</guid><dc:creator>Brazil Vibanco</dc:creator><description>Additionally to the steps, you have to keep in mind that you can configure the response on the web Api as you want, it could be based on the start of the process or you can validate structure, information, etc. within the web api.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/55552?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 07:13:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9d15d038-5313-4a7a-aad3-c9772c2386a9</guid><dc:creator>rohitr303</dc:creator><description>Steps:&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Go to designer, inside designer go to your application&lt;br /&gt;
-&amp;gt; Select create new Web api&lt;br /&gt;
-&amp;gt; Give the name to the web api. description and end point which should be unique.Also set the security of the web api to appropriate &lt;br /&gt;
    user.&lt;br /&gt;
-&amp;gt; Also the method type of the web api should be post because when we trigger a smart service from a web api ,the method should &lt;br /&gt;
     always be post &lt;br /&gt;
-&amp;gt; Once the above steps are done and you proceed you will get multiple web api templates ,from that select &amp;quot;Start Process Model&amp;quot; &lt;br /&gt;
    template&lt;br /&gt;
-&amp;gt; A predefined code will occur then in that code make the alteration like setting the property processModel with a constant which holds &lt;br /&gt;
    your process model name and processParameters to a!fromJson(http!request.body),&lt;br /&gt;
-&amp;gt; Done &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope this will help you&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/55549?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 07:03:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:661df51e-4e7a-4d23-861f-d00b2abd2ef6</guid><dc:creator>aloks0189</dc:creator><description>Adding to @Adityau comment, also make sure to choose the method as POST while creating the web API&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to Process model integration</title><link>https://community.appian.com/thread/55537?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 06:30:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b7f13905-daee-4a1c-8fb7-e02bd839bdfc</guid><dc:creator>Aditya</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt; &lt;br /&gt; Your web api code should be something like below: &lt;br /&gt; &lt;br /&gt; with(&lt;br /&gt; a!startProcess(&lt;br /&gt; processModel: cons!yourProcessModel,&lt;br /&gt; processParameters: a!fromJson(&lt;br /&gt; http!request.body&lt;br /&gt; ),&lt;br /&gt; onSuccess: a!httpResponse(&lt;br /&gt; statusCode: 200,&lt;br /&gt; headers: {&lt;br /&gt; a!httpHeader(name: &amp;quot;Content-Type&amp;quot;, value: &amp;quot;application/json&amp;quot;)&lt;br /&gt; },&lt;br /&gt; body: a!toJson(&lt;br /&gt;&amp;nbsp; {&amp;quot;Your Success Message&amp;quot;}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; onError: a!httpResponse(&lt;br /&gt; statusCode: 500,&lt;br /&gt; headers: {&lt;br /&gt; a!httpHeader(name: &amp;quot;Content-Type&amp;quot;, value: &amp;quot;application/json&amp;quot;)&lt;br /&gt; },&lt;br /&gt; body: a!toJson(&lt;br /&gt; {&lt;br /&gt; error: &amp;quot;There was an error starting the process&amp;quot;&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>