<?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 Re: Formatting Request Payload as an Array rather than a Hash in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9047#M3725</link>
    <description>&lt;P&gt;No worries! I appreciate you looking into this!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Feb 2025 21:01:01 GMT</pubDate>
    <dc:creator>demontoya</dc:creator>
    <dc:date>2025-02-28T21:01:01Z</dc:date>
    <item>
      <title>Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9003#M3716</link>
      <description>&lt;P&gt;I am trying to format a request payload to be an array of objects, but it appears that the &lt;I&gt;payload&amp;nbsp;&lt;/I&gt;HTTP method defaults to formatting it as a hash such as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;{
  email: "exampleemail",
  name: "John Jacob Jingleheimer Schmidt"
}&lt;/LI-CODE&gt;&lt;P&gt;However, it needs to be enveloped in an array like as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    email: "exampleemail",
    name: "John Jacob Jingleheimer Schmidt"
  }
]&lt;/LI-CODE&gt;&lt;P&gt;The &lt;EM&gt;payload&lt;/EM&gt; HTTP method does not accept arrays, as this will throw an error. Is there a way to do this? What are your thoughts on this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 06:28:40 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9003#M3716</guid>
      <dc:creator>demontoya</dc:creator>
      <dc:date>2025-02-28T06:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9004#M3717</link>
      <description>&lt;P&gt;I just tested this and the HTTP request payload (specifically for a POST) will accept an array without issue. You may be encoding it incorrectly. Can you provide more details on the error you receive?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 06:47:13 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9004#M3717</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2025-02-28T06:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9045#M3723</link>
      <description>&lt;P&gt;I tried enveloping the hash in an array in the following manner:&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;request_payload = {"data" =&amp;gt; {"email" =&amp;gt; "exampleemail", "name" =&amp;gt; "John Jacob Jingleheimer Schmidt"}}

arrayed_req_payload = [request_payload['data']]

post(url).payload(arrayed_req_payload || {})
&lt;/LI-CODE&gt;&lt;P&gt;But I get an error saying &lt;FONT face="andale mono,times" color="#FF0000"&gt;undefined method `to_hash' for [nil]:Array at line: xxx&amp;nbsp;&lt;/FONT&gt;where the line is the &lt;EM&gt;payload&lt;/EM&gt; method. It's as if it is trying to convert it to a hash.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 19:58:23 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9045#M3723</guid>
      <dc:creator>demontoya</dc:creator>
      <dc:date>2025-02-28T19:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9046#M3724</link>
      <description>&lt;P&gt;Ah, you're in the connector SDK. This is interesting...&lt;/P&gt;&lt;P&gt;Looking at the SDK docs, it does indeed look like it's trying to hash whatever you put inside payload. I recommend checking with support about this. Sorry I couldn't be more help!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 20:19:33 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9046#M3724</guid>
      <dc:creator>gary1</dc:creator>
      <dc:date>2025-02-28T20:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9047#M3725</link>
      <description>&lt;P&gt;No worries! I appreciate you looking into this!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 21:01:01 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9047#M3725</guid>
      <dc:creator>demontoya</dc:creator>
      <dc:date>2025-02-28T21:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9059#M3726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://systematic.workato.com/t5/user/viewprofilepage/user-id/11528"&gt;@demontoya&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Could you please do the below modification in your code:&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;post(url).payload(arrayed_req_payload.to_json).headers("Content-Type" =&amp;gt; "application/json")&lt;/LI-CODE&gt;&lt;P&gt;Please let me know if that worked for you.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards,&lt;BR /&gt;Shivakumara K A&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 12:49:17 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9059#M3726</guid>
      <dc:creator>shivakumara</dc:creator>
      <dc:date>2025-03-03T12:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9098#M3742</link>
      <description>&lt;P&gt;Thank you for the suggestion! This did not work, giving a similar error message as before: &lt;FONT color="#FF0000"&gt;undefined method `to_hash' for #&amp;lt;String:0x0...&amp;gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 19:09:30 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9098#M3742</guid>
      <dc:creator>demontoya</dc:creator>
      <dc:date>2025-03-06T19:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Request Payload as an Array rather than a Hash</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9099#M3743</link>
      <description>&lt;P&gt;Found a solution to this - quite silly now that I think about it.&lt;/P&gt;&lt;P&gt;Since the&amp;nbsp;&lt;EM&gt;payload&lt;/EM&gt; method does not support an array as an argument, I looked at the SDK Reference &amp;gt; HTTP Methods docs yet again, and realized that I could also pass arguments directly within the verb methods such that:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;request_payload = {"data" =&amp;gt; {"email" =&amp;gt; "exampleemail", "name" =&amp;gt; "John Jacob Jingleheimer Schmidt"}}

arrayed_req_payload = [request_payload['data']]

post(url, arrayed_req_payload)&lt;/LI-CODE&gt;&lt;P&gt;This successfully passed the arrayed payload into the request body. Thank you all for your help and contribution!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 19:19:12 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/formatting-request-payload-as-an-array-rather-than-a-hash/m-p/9099#M3743</guid>
      <dc:creator>demontoya</dc:creator>
      <dc:date>2025-03-06T19:19:12Z</dc:date>
    </item>
  </channel>
</rss>

