Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • How can I send the body to HTTP POST method request? I understand that setBody accepts only string argument and I need to json.serialize(payload). Commented Aug 17, 2022 at 7:26
  • @Stojcheski - you would instantiate the object and assign whatever values needed - I've updated my answer with an example. Commented Aug 17, 2022 at 15:17
  • One more question. I need to set the value of the List<Column> columns to my entry List<String> columns and I get illegal assignment from List to List which is to be expected. So, how do I make the method accept List<Column>? Commented Aug 17, 2022 at 18:47
  • The JSON example provided shows that columns is not an array of Strings, but an array of Objects - this is why we defined an inner class called Column. To convert from your List<String> variable, you may need to iterate over its contents and instantiate column objects. I've provided an example above in my answer. Commented Aug 17, 2022 at 22:17
  • Hey @JesseWheeler I've updated my question with my method and I still cannot solve this problem of how can I send data.columns in my method. Can you provide further explanation on your thought process. I'm sorry for still bothering you about this. Thank you. Commented Aug 24, 2022 at 18:14