<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Intel XDK web services parameter types Array in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Intel-XDK-web-services-parameter-types-Array/m-p/1086987#M63773</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I try to create web service method to upload parameter as JSON data through Ajax POST.&lt;/P&gt;

&lt;P&gt;It is working fine with a single "string" parameter, but not "Array" type.&lt;/P&gt;

&lt;P&gt;Could anyone help?&lt;/P&gt;

&lt;P&gt;This is the mywebservicemethod.json file:&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
	"endpoints": [&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; "name": "Update interests catergories",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; "methods": [&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "MethodName": "updateInterests",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Synopsis": "Update interests",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "parameters": [&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Name": "newInterestedCategories",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Required": "Y",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Default": [],&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Type": "array",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Description": "categories array"&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; ]&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	]&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;And in mywebservicemethod.js file, I try to read parameter:&lt;/P&gt;

&lt;P&gt;var categories =&amp;nbsp;params.newInterestedCategories;&lt;/P&gt;

&lt;P&gt;in ajax call, it is converted to JSON:&lt;/P&gt;

&lt;P&gt;data: JSON.stringify( {"newInterestedCategories":categories} ),&lt;/P&gt;

&lt;P&gt;Under Explore Services, I typed in ["News"] as Value of parameter.&lt;/P&gt;

&lt;P&gt;In the end, the ajax call send this as captured by Fiddle:&lt;/P&gt;

&lt;P&gt;{"newInterestedCategories":"[\"News\"]"}&lt;/P&gt;

&lt;P&gt;What I want is&amp;nbsp;&lt;SPAN style="font-size: 13.008px; line-height: 15.6096px;"&gt;{"newInterestedCategories":["News"]}&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;By the way, angularjs is referenced in the project.&lt;/P&gt;

&lt;P&gt;Thanks very much!&lt;/P&gt;

&lt;P&gt;Qiang&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 05:57:53 GMT</pubDate>
    <dc:creator>Qiang_L_1</dc:creator>
    <dc:date>2016-02-25T05:57:53Z</dc:date>
    <item>
      <title>Intel XDK web services parameter types Array</title>
      <link>https://community.intel.com/t5/Software-Archive/Intel-XDK-web-services-parameter-types-Array/m-p/1086987#M63773</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I try to create web service method to upload parameter as JSON data through Ajax POST.&lt;/P&gt;

&lt;P&gt;It is working fine with a single "string" parameter, but not "Array" type.&lt;/P&gt;

&lt;P&gt;Could anyone help?&lt;/P&gt;

&lt;P&gt;This is the mywebservicemethod.json file:&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
	"endpoints": [&lt;BR /&gt;
	&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; "name": "Update interests catergories",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; "methods": [&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "MethodName": "updateInterests",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Synopsis": "Update interests",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "parameters": [&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Name": "newInterestedCategories",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Required": "Y",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Default": [],&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Type": "array",&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Description": "categories array"&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; ]&lt;BR /&gt;
	&amp;nbsp; }&lt;BR /&gt;
	]&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;And in mywebservicemethod.js file, I try to read parameter:&lt;/P&gt;

&lt;P&gt;var categories =&amp;nbsp;params.newInterestedCategories;&lt;/P&gt;

&lt;P&gt;in ajax call, it is converted to JSON:&lt;/P&gt;

&lt;P&gt;data: JSON.stringify( {"newInterestedCategories":categories} ),&lt;/P&gt;

&lt;P&gt;Under Explore Services, I typed in ["News"] as Value of parameter.&lt;/P&gt;

&lt;P&gt;In the end, the ajax call send this as captured by Fiddle:&lt;/P&gt;

&lt;P&gt;{"newInterestedCategories":"[\"News\"]"}&lt;/P&gt;

&lt;P&gt;What I want is&amp;nbsp;&lt;SPAN style="font-size: 13.008px; line-height: 15.6096px;"&gt;{"newInterestedCategories":["News"]}&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;By the way, angularjs is referenced in the project.&lt;/P&gt;

&lt;P&gt;Thanks very much!&lt;/P&gt;

&lt;P&gt;Qiang&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 05:57:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Intel-XDK-web-services-parameter-types-Array/m-p/1086987#M63773</guid>
      <dc:creator>Qiang_L_1</dc:creator>
      <dc:date>2016-02-25T05:57:53Z</dc:date>
    </item>
  </channel>
</rss>

