<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/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>Get query builder answer via REST API</title><link>https://www.aras.com/community/f/getting-started/6379/get-query-builder-answer-via-rest-api</link><description>Hello ARAS community, 
 could you tell me if its possible to get aml result of a query via REST API ? (POSTMAN). 
 I can easily find my query via postman but i cannot execute it. 
 I tried to creat a method with inside a call to my query and then call</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Get query builder answer via REST API</title><link>https://www.aras.com/community/thread/3621?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2019 16:24:35 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:3606d47a-6c9e-45f9-b3f8-6c9522c33e55</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The easiest way to do this would be to add a parameter to your query definition to hold some identifying information about the item like the name. You can then add a condition to your query definition like &amp;#39;Name = $my_name_param&amp;#39;. This will allow you to filter your query by passing in optional parameters.&lt;/p&gt;
&lt;p&gt;In order to add this parameter programmatically,&amp;nbsp;you can get the qry_QueryParameter relationship and set the&amp;nbsp;&lt;em&gt;value&lt;/em&gt; of that in order to filter your query. For example,&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;queryDef.getRelationships(&amp;quot;qry_QueryParameter&amp;quot;).getItemByIndex(0).setProperty(&amp;quot;value&amp;quot;, &amp;quot;My Specific Item Name&amp;quot;);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re new to using parameters with query definitions, I&amp;#39;d recommend checking out the first part of&amp;nbsp;&lt;a href="/b/english/posts/tech-tip-filter-a-tree-grid-view-with-parameters"&gt;this blog post&lt;/a&gt;&amp;nbsp;which goes into more specific steps on how to set up and use a parameter.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get query builder answer via REST API</title><link>https://www.aras.com/community/thread/3620?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2019 14:50:22 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:bc22e383-4e6c-490a-a242-345a61995198</guid><dc:creator>Alexandrecimp</dc:creator><description>&lt;p&gt;here is the solution :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;rest request :&lt;/p&gt;
&lt;p&gt;http://localhost/GTSI_I2/server/odata/method.*method_name*&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;methode :&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f4af.svg" title="100"&gt;&amp;#x1f4af;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Innovator inn = this.getInnovator();&lt;br /&gt;var qry_id = &amp;quot;9D6022A8359748F7BB50AF18F6A41830&amp;quot;; // QD id&lt;/p&gt;
&lt;p&gt;// get query definition with relationships&lt;br /&gt;var queryDef = inn.newItem(&amp;quot;qry_QueryDefinition&amp;quot;,&amp;quot;get&amp;quot;);&lt;br /&gt;queryDef.setID(qry_id);&lt;br /&gt;queryDef.setAttribute(&amp;quot;levels&amp;quot;,&amp;quot;10&amp;quot;);&lt;br /&gt;queryDef = queryDef.apply();&lt;/p&gt;
&lt;p&gt;// execute query&lt;br /&gt;queryDef.setAction(&amp;quot;qry_ExecuteQueryDefinition&amp;quot;);&lt;br /&gt;queryDef.setAttribute(&amp;quot;levels&amp;quot;,&amp;quot;10&amp;quot;);&lt;br /&gt;var res = queryDef.apply();&lt;/p&gt;
&lt;p&gt;return res;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;With this we got all the item type and their dependancy of the database.&lt;/p&gt;
&lt;p&gt;Now I need to select only one choosen item type and his dependency.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;any idea ?&lt;/p&gt;
&lt;p&gt;thanks :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get query builder answer via REST API</title><link>https://www.aras.com/community/thread/3613?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2019 19:30:28 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:2e1d3e42-e3dc-434c-8999-f80f0f54c857</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think you&amp;#39;re on the right track by creating a separate server method to perform the query. You can check out this blog post which goes over how to &lt;a href="/b/english/posts/using-query-definitions-method-code"&gt;run a query from a Query Definition programmatically&lt;/a&gt;. Once you have that method written, you can call that custom method from the REST API by doing a POST request with a URL like the one below. You&amp;#39;ll just need to update the&amp;nbsp;&lt;strong&gt;bolded&lt;/strong&gt; part of the URL with the name of your custom method.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;POST {base url}/method.&lt;strong&gt;RunMyQueryDefinition&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;quot;my_param&amp;quot; : &amp;quot;my_param_value&amp;quot;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;You can also pass a body along with this request if you need to pass in any additional parameters into your custom method. This body will turn into the&amp;nbsp;&lt;em&gt;this&lt;/em&gt; context item of your custom method. As an example, with the body above, I could add a line like this to my custom method to get the parameter passed in.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;this.getProperty(&amp;quot;my_param&amp;quot;);&lt;/em&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Chris&lt;/p&gt;
&lt;p&gt;Christopher Gillis&lt;/p&gt;
&lt;p&gt;Aras Labs Software Engineer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>