<?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 processParameter</title><link>https://community.appian.com/discussions/f/general/19430/web-api-to-processparameter</link><description>Hello all, 
 I want to send the following body from Web API to Process Model, I need to change the format as shown below, 
 Web API Code: 
 { &amp;quot;references&amp;quot;: { &amp;quot;ABC&amp;quot;: &amp;quot;111&amp;quot;, &amp;quot;DEF&amp;quot;: &amp;quot;222&amp;quot;, &amp;quot;GHI&amp;quot;: &amp;quot;333&amp;quot;, &amp;quot;JKL&amp;quot;: &amp;quot;444&amp;quot;, &amp;quot;other&amp;quot;: {&amp;quot;MNO-555&amp;quot;, &amp;quot;XYZ-123&amp;quot;, &amp;quot;PQR</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Web API to processParameter</title><link>https://community.appian.com/thread/75998?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 08:13:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ca2406eb-17a6-424a-a640-100dbad7a9c7</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;[stands on the shoulders of giants!!!]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to processParameter</title><link>https://community.appian.com/thread/75997?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 00:07:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9f00e050-5a61-4371-b2bb-d60553ee0e28</guid><dc:creator>sunilc</dc:creator><description>&lt;p&gt;Perfect! Exactly matches my requirement.. thanks much Peter!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to processParameter</title><link>https://community.appian.com/thread/75996?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2020 21:45:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7edc6c56-3ecf-452b-97ae-3c0fc1c28dc5</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;If you are certain that the labels for the first four items&amp;nbsp;are always the same, then you can index them directly to reassign them (adding on top of what Stewart already suggested). For example, this should work:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!data: {
    &amp;quot;references&amp;quot;: {
      &amp;quot;ABC&amp;quot;: &amp;quot;111&amp;quot;,
      &amp;quot;DEF&amp;quot;: &amp;quot;222&amp;quot;,
      &amp;quot;GHI&amp;quot;: &amp;quot;333&amp;quot;,
      &amp;quot;JKL&amp;quot;: &amp;quot;444&amp;quot;,
      &amp;quot;other&amp;quot;: {&amp;quot;MNO-555&amp;quot;, &amp;quot;XYZ-123&amp;quot;, &amp;quot;PQR-666&amp;quot;}
    }
  },
  {
    {ref_text: local!data.references.ABC, refSource_text: &amp;quot;ABC&amp;quot;},
    {ref_text: local!data.references.DEF, refSource_text: &amp;quot;DEF&amp;quot;},
    {ref_text: local!data.references.GHI, refSource_text: &amp;quot;GHI&amp;quot;},
    {ref_text: local!data.references.JKL, refSource_text: &amp;quot;JKL&amp;quot;},
    a!forEach(
      items: local!data.references.other,
      expression: a!localVariables(
        local!nameValues: fn!split(fv!item,&amp;quot;-&amp;quot;),
        {
          ref_text: local!nameValues[2],
          refSource_text: local!nameValues[1]
        }
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In general though, I&amp;#39;d recommend looking at the API to see if it can be refactored to support the information in a clearer way. This is not specific to Appian; most tools expect data to be returned in a set of key value pairs where the key is consistent across a list of values. It will be much easier to deal with the data in Appian if it uses a more consistent format.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to processParameter</title><link>https://community.appian.com/thread/75992?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2020 18:44:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9ab29353-afa1-4004-a631-8178ccba0af0</guid><dc:creator>sunilc</dc:creator><description>&lt;p&gt;Thanks Stewart. Yes, the label values are going to be same in the first set. And, I need to eventually store these values in a CDT.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Web API to processParameter</title><link>https://community.appian.com/thread/75988?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2020 17:02:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4fafc193-54e2-41d4-a6c1-8fd642046bd9</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Getting the values form the &amp;quot;other&amp;quot; segment of the data is pretty straightforward:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!forEach(
    items: local!myData.references.other,
    expression: 
      with(
        local!nameValues: fn!split(fv!item,&amp;quot;-&amp;quot;),
        {
          ref_text: local!nameValues[2],
          refSource_text: local!nameValues[1]
        }
      )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The issue is with the first set of data in the array in that you would need to set up a loop to process the items but unless they&amp;#39;re always&amp;nbsp;going to have the same &amp;#39;label&amp;#39; in their label:value pair we can&amp;#39;t extract the label and value from the individual item. Unless you can tell me you know in advance what the list of dictionary labels would be for any given instance of the data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>