<?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: Task 6 - API endpoint with payload required (July Developer Challenge - &amp;quot;Reverse APIs&amp;quot; in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13768556#M2029278</link>
    <description>&lt;P&gt;Excellent! Would it help to have a quick discussion on different ways in JS to do this? There are many, I could suggest a few ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 05:21:42 GMT</pubDate>
    <dc:creator>qmacro</dc:creator>
    <dc:date>2024-07-23T05:21:42Z</dc:date>
    <item>
      <title>Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs")</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13765529#M2029210</link>
      <description>&lt;P&gt;This is a task in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.sap.com/t5/application-development-blog-posts/2024-07-quot-reverse-apis-quot-sap-developer-challenge/ba-p/13749653" target="_blank" rel="nofollow noopener"&gt;July Developer Challenge - "Reverse APIs"&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;This task gets you to add another API endpoint to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;plain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"REST" service you have, but will be a little different in its definition, implementation, and how it's called.&lt;/P&gt;&lt;H2&gt;Background&lt;/H2&gt;&lt;P&gt;HTTP-based API endpoints, whatever the protocol, can differ in various ways, such as:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;how they're called (which HTTP method)&lt;/LI&gt;&lt;LI&gt;whether they expect a payload (a body) in the HTTP request&lt;/LI&gt;&lt;LI&gt;what they do, what effect they have at the server side&lt;/LI&gt;&lt;LI&gt;what resource and representation they return (if any)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;HTTP is an application protocol and there are already well understood semantic meanings for each of the methods (also known as "verbs", where the URLs are the "nouns"). There are some protocols that abuse or ignore these semantics, particularly the set of heavyweight "Web Services" from a decade or so ago, known as "WS-Deathstar" (due to their weight and complexity), SOAP, and even today we have GraphQL that arguably abuses HTTP as a mere transport layer. Yes, "abuse" is a strong word, but, as my&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.linkedin.com/in/djadams/" target="_blank" rel="nofollow noopener"&gt;bio&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;hints at, it's an opinion I hold, and is one of many &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bio.png" style="width: 313px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/138709iF44A397EA563D7FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="bio.png" alt="bio.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyway, in addition to those differences listed earlier, one must also consider the duumvirate (yes, I did just use that word) of:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;idempotency&lt;/LI&gt;&lt;LI&gt;side effects&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Idempotency (from the Latin, as is, of course, duumvirate) essentially means "having the same effect". To quote the excellent MDN docs on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Glossary/Idempotent" target="_blank" rel="nofollow noopener"&gt;Idempotency&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;An HTTP method is idempotent if the intended effect on the server of making a single request is the same as the effect of making several identical requests.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Examples of HTTP methods that have this idempotency characteristic are: GET, HEAD, PUT and DELETE (yes!).&lt;/P&gt;&lt;P&gt;A side effect in this context means that in handling or otherwise fulfilling an HTTP request, state is changed on the server. HTTP methods that do not have side effects are known as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP" target="_blank" rel="nofollow noopener"&gt;safe&lt;/A&gt;. Examples of HTTP methods that do have side effects, i.e. that are not safe, are POST, PUT and DELETE. Examples of HTTP methods that are side effect free, i.e. safe, are GET, HEAD and OPTIONS.&lt;/P&gt;&lt;P&gt;Semantic meanings are important, as they form part of the "contract" of behaviour between clients and servers.&lt;/P&gt;&lt;P&gt;Why am I telling you all this? Because CDL, CAP's definition language that you use to define your overall CDS model, has a couple of keywords that are important in this context.&lt;/P&gt;&lt;H3&gt;Actions and functions&lt;/H3&gt;&lt;P&gt;In Capire's section on Providing Services, there's a subsection on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://cap.cloud.sap/docs/guides/providing-services#actions-functions" target="_blank" rel="nofollow noopener"&gt;Actions &amp;amp; Functions&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that explain more. I recommend you go and read that section, then come back here.&lt;/P&gt;&lt;P&gt;Did you notice the explanation was in the context of OData? That's because it's where the specific definitions originate, but these definitions make sense even outside the context of OData, such as when serving via the "REST" protocol.&lt;/P&gt;&lt;P&gt;In summary, we can see that both actions and functions are for providing API endpoints that represent resources beyond the standard CRUD+Q requests, although:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Functions are for defining API endpoints that are safe, these endpoints are to be requested with HTTP GET, and any data should be supplied in the URL. There's a related rule here that functions must be addressed (in the URL) with brackets, even if there's no data to supply. Functions, on the whole, are for returning data.&lt;/LI&gt;&lt;LI&gt;Actions are for defining API endpoints that &lt;EM&gt;may&lt;/EM&gt; have side effects, and these endpoints must be requested with HTTP POST; any data that is to be supplied must be as a payload to the POST request. In addition, actions may return nothing (just an HTTP status code and headers).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In addition (but not relevant for this task), both functions and actions can be bound or unbound. The idea of "unbound" is what we generally think of in terms of simple API endpoints. The "bound" concept is from OData, and is about calling an action or function relative to a specific entity. In such cases there's an extra implicit "binding parameter" that the implementation receives in the request, as a connection to the instance of the entity to which the called function is bound.&lt;/P&gt;&lt;P&gt;The first task in the context of this current&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;plain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"REST" service was an unbound function (note the brackets, despite no parameters):&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;/rest/plain/theAnswer()&lt;/PRE&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;This task will require you to define and implement a simple unbound action, which means you must:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;action&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;keyword&lt;/LI&gt;&lt;LI&gt;call it using a request with the HTTP POST method&lt;/LI&gt;&lt;LI&gt;send the data in the payload of the request&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You will also not need to use brackets at the end of the URL.&lt;/P&gt;&lt;H2&gt;The requirements&lt;/H2&gt;&lt;P&gt;Here are the specific requirements for this task.&lt;/P&gt;&lt;P&gt;In the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;plain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;service you have already, define an unbound action that expects a list of integers. The implementation of that unbound action must determine the highest of those numbers, and return it as a single integer.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that if you are running CAP Node.js version 8 then you will have to annotate your&amp;nbsp;&lt;/SPAN&gt;action&lt;SPAN&gt;&amp;nbsp;definition with&amp;nbsp;&lt;/SPAN&gt;@open&lt;SPAN&gt;. See the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://qmacro.org/blog/posts/2024/07/24/automatic-validation-in-odata-and-rest-calls-with-cap/#opentypes" target="_blank" rel="nofollow noopener"&gt;Open Types section&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;of the blog post&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://qmacro.org/blog/posts/2024/07/24/automatic-validation-in-odata-and-rest-calls-with-cap/" target="_blank" rel="nofollow noopener"&gt;Automatic validation in OData and REST calls with CAP&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;for more information.&lt;/SPAN&gt;&lt;/P&gt;&lt;H2&gt;Submitting to the TESTER&lt;/H2&gt;&lt;P&gt;Now you're ready to submit your CANDIDATE service, with this new API endpoint, to the TESTER!&lt;/P&gt;&lt;P&gt;Note that the TESTER will be calling your action via HTTP POST, and supplying the list of integers as an array, in a JSON representation, in other words, like this:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;POST&lt;/SPAN&gt;&lt;SPAN class=""&gt; /rest/plain/highestValue HTTP/1.1&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Host:&lt;/SPAN&gt; localhost:8000&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Content-Type:&lt;/SPAN&gt; application/json&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Content-Length:&lt;/SPAN&gt; 19&lt;/SPAN&gt;

&lt;SPAN class=""&gt;[&lt;/SPAN&gt;54&lt;SPAN class=""&gt;,&lt;/SPAN&gt; 203&lt;SPAN class=""&gt;,&lt;/SPAN&gt; -3&lt;SPAN class=""&gt;,&lt;/SPAN&gt; 0&lt;SPAN class=""&gt;,&lt;/SPAN&gt; 1&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;H3&gt;The payload&lt;/H3&gt;&lt;P&gt;The task identifier you need to supply in the payload of your submission is:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;plain-highestValue&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;You'll have already done this sort of thing&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.sap.com/t5/application-development-discussions/july-developer-challenge-quot-reverse-apis-quot-task-1-your-first-service/m-p/13752205" target="_blank" rel="nofollow noopener"&gt;previously&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;so just head back there for the more detailed instructions if you need them, or to the the section titled "&lt;A href="https://community.sap.com/t5/application-development-blog-posts/2024-07-quot-reverse-apis-quot-sap-developer-challenge/ba-p/13749653#toc-hId--553513390" target="_blank" rel="nofollow noopener"&gt;The Tester service, and making a test request&lt;/A&gt;" in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.sap.com/t5/application-development-blog-posts/2024-07-quot-reverse-apis-quot-sap-developer-challenge/ba-p/13749653" target="_blank" rel="nofollow noopener"&gt;main challenge blog post&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You'll need to submit a JSON payload like this:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;{
  &lt;SPAN class=""&gt;"communityid"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&amp;lt;your-community-id&amp;gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;,
  &lt;SPAN class=""&gt;"serviceurl"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&amp;lt;the-URL-of-your-service&amp;gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;,
  &lt;SPAN class=""&gt;"task"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;plain-highestValue&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;
}&lt;/PRE&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;And, just as with the previous (and all further tasks):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;the value for the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;communityid&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property should be your ID on this SAP Community platform (e.g. mine is "qmacro")&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;the value for the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;serviceurl&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property should be the absolute URL (i.e. including the scheme), of your CANDIDATE&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;service&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;which&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;contains&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the API endpoint (see&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.sap.com/t5/application-development-blog-posts/2024-07-quot-reverse-apis-quot-sap-developer-challenge/ba-p/13749653#toc-hId--356999885" target="_blank" rel="nofollow noopener"&gt;&lt;span class="lia-unicode-emoji" title=":information:"&gt;ℹ️&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;A note on URLs and services&lt;/A&gt;).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;That's it!&lt;/P&gt;&lt;H2&gt;Logging of test results&lt;/H2&gt;&lt;P&gt;Remember that you can check on your progress, and the progress of your fellow participants - all requests are logged and are available in an entity set served by the TESTER service. The entity set URL is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developer-challenge-2024-07.cfapps.eu10.hana.ondemand.com/tester/Testlog" target="_blank" rel="nofollow noopener"&gt;https://developer-challenge-2024-07.cfapps.eu10.hana.ondemand.com/tester/Testlog&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and being an OData V4 entity set, all the normal OData system query options are available to you for digging into that information.&lt;/P&gt;&lt;P&gt;Until the next task, have fun, and if you have any questions or comments, leave them below!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 12:02:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13765529#M2029210</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-26T12:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13765754#M2029214</link>
      <description>&lt;P&gt;That was great! I now know how to handle arrays, especially when passing through cURL. The ES6 spread syntax was a nice find using Google.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mwn_0-1721376934663.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/138856i2DC3E626C471FDAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mwn_0-1721376934663.png" alt="mwn_0-1721376934663.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 08:16:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13765754#M2029214</guid>
      <dc:creator>mwn</dc:creator>
      <dc:date>2024-07-19T08:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766333#M2029219</link>
      <description>&lt;P&gt;Great to hear, well done!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 14:11:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766333#M2029219</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-19T14:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766362#M2029220</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Another cool challenge!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tobiasz_h_0-1721400335251.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139221iB70146D3C0698834/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tobiasz_h_0-1721400335251.png" alt="tobiasz_h_0-1721400335251.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 14:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766362#M2029220</guid>
      <dc:creator>tobiasz_h</dc:creator>
      <dc:date>2024-07-19T14:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766424#M2029223</link>
      <description>&lt;P&gt;Done with a reduce method! btw:&lt;/P&gt;&lt;P&gt;Why did the array go to therapy?&lt;/P&gt;&lt;P&gt;Because it had too many issues to reduce!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="spassaro_0-1721406641310.png" style="width: 694px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139246i5EABD9C72B1F2E1C/image-dimensions/694x421?v=v2" width="694" height="421" role="button" title="spassaro_0-1721406641310.png" alt="spassaro_0-1721406641310.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 16:32:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766424#M2029223</guid>
      <dc:creator>spassaro</dc:creator>
      <dc:date>2024-07-19T16:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766472#M2029224</link>
      <description>&lt;P&gt;Here's my submission (finally it has worked):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MK_0-1721415384688.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139259iE4A46D667BBC6079/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MK_0-1721415384688.png" alt="MK_0-1721415384688.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Don't try to sort an array with "toSorted", it works well in BAS but gives you a "500 Internal Server Error" after deploying&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 19:01:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766472#M2029224</guid>
      <dc:creator>M-K</dc:creator>
      <dc:date>2024-07-19T19:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766516#M2029225</link>
      <description>&lt;P&gt;My submission for task 6.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alpesa1990_0-1721428392527.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139277iEF62FCF92CF5DEA3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alpesa1990_0-1721428392527.png" alt="Alpesa1990_0-1721428392527.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Good challenge!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 22:33:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766516#M2029225</guid>
      <dc:creator>Alpesa1990</dc:creator>
      <dc:date>2024-07-19T22:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766519#M2029226</link>
      <description>&lt;P&gt;What a task this was!! Took me some debugging to get the sort working, I enjoyed every bit of it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my submission -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sudarshan_b_0-1721429706535.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139278iC3FDE2723E7A7B6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sudarshan_b_0-1721429706535.png" alt="sudarshan_b_0-1721429706535.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 22:55:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766519#M2029226</guid>
      <dc:creator>sudarshan_b</dc:creator>
      <dc:date>2024-07-19T22:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766686#M2029230</link>
      <description>&lt;P&gt;Here is my submission for Task no 6.&lt;/P&gt;&lt;P&gt;Another challenging task and lot more to learn.Lot of debugging required as well.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gphadnis2000_0-1721469028369.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139365iBA776D09DBC2A6B2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gphadnis2000_0-1721469028369.png" alt="gphadnis2000_0-1721469028369.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Another challenging task and lot more things to learn.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gphadnis2000_0-1721470461412.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139366i2943AE7728A5D3EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gphadnis2000_0-1721470461412.png" alt="gphadnis2000_0-1721470461412.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2024 10:14:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766686#M2029230</guid>
      <dc:creator>gphadnis2000</dc:creator>
      <dc:date>2024-07-20T10:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766772#M2029231</link>
      <description>&lt;P&gt;Would it not be more idiomatic for CAP to use a curl request with some input like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="json"&gt;{ "input" = [54,203,-3,0,1] }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;this would allow the service to type check "input" is an array of numbers with service definition like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;action maxValue(input: array of Int32) returns Int32&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the current service definition - at least my implementation will throw a HTTP 500 error if the request payload has an array element which is not a number&amp;nbsp;&lt;/P&gt;&lt;P&gt;example: below request payload may throw an error with highestValue service&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="json"&gt;[54,203,-3,0,1,"i am not a number"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2024 18:58:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766772#M2029231</guid>
      <dc:creator>sachin_sap</dc:creator>
      <dc:date>2024-07-20T18:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766837#M2029237</link>
      <description>&lt;P&gt;Hehe.&lt;/P&gt;&lt;P&gt;BTW I was hoping someone would use `reduce` ... it's &lt;A href="https://www.google.com/search?q=site%3Aqmacro.org+reduce" target="_self"&gt;one of my fav functions&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 07:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766837#M2029237</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-21T07:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766838#M2029238</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 07:19:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766838#M2029238</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-21T07:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766839#M2029239</link>
      <description>&lt;P&gt;That's great to hear!&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 07:19:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766839#M2029239</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-21T07:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766840#M2029240</link>
      <description>&lt;P&gt;That makes me happy. Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 07:19:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766840#M2029240</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-21T07:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766857#M2029241</link>
      <description>&lt;P&gt;Great thoughts! I'm not sure what is more idiomatic here, a simple array (`[1,2,3]`) or an array as the value of a property in an object (`{"vals": [1,2,3]}`). Can you share the exact error message(s) that are thrown when you supply a string in the array (like you showed)? And good work for digging in and finding out!&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 07:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766857#M2029241</guid>
      <dc:creator>qmacro</dc:creator>
      <dc:date>2024-07-21T07:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766933#M2029247</link>
      <description>&lt;P&gt;Here my submission, top Challenge, i have learned a lot,&lt;/P&gt;&lt;P&gt;Regards, Matthias&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatLakaemper_0-1721567349992.png" style="width: 764px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139463i123AD0F1D927DE9A/image-dimensions/764x268?v=v2" width="764" height="268" role="button" title="MatLakaemper_0-1721567349992.png" alt="MatLakaemper_0-1721567349992.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatLakaemper_1-1721567378265.png" style="width: 739px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139464i66F99E07D61B1796/image-dimensions/739x169?v=v2" width="739" height="169" role="button" title="MatLakaemper_1-1721567378265.png" alt="MatLakaemper_1-1721567378265.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 13:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766933#M2029247</guid>
      <dc:creator>MatLakaemper</dc:creator>
      <dc:date>2024-07-21T13:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766945#M2029249</link>
      <description>&lt;P&gt;Error with(`[1,2,3,"not a number"]`)&lt;/P&gt;&lt;P&gt;this maybe because I used Math.max() function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="json"&gt;HTTP/1.1 500 Internal Server Error

{
  "error": {
    "code": "500",
    "message": "Failed to validate return value of type 'cds.Int32' for custom action 'plain.highestValue': Value NaN is invalid."
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error with &lt;SPAN&gt;(`{"input": [1,2,3,4,5,"not a number"]}`)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="json"&gt;HTTP/1.1 400 Bad Request
{
  "error": {
    "message": "Value not a number is not a valid Int32",
    "target": "input[5]",
    "code": "400",
    "@Common.numericSeverity": 4
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 14:21:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766945#M2029249</guid>
      <dc:creator>sachin_sap</dc:creator>
      <dc:date>2024-07-21T14:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766999#M2029250</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/53"&gt;@qmacro&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please tell me how to define an action that takes a plain array as input?&lt;/P&gt;&lt;P&gt;I can define an array with a name like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;action highestValue(input: array of Int32) returns Int32;&lt;/LI-CODE&gt;&lt;P&gt;But I cannot define it without a name like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;action highestValue(array of Int32) returns Int32;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 19:59:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13766999#M2029250</guid>
      <dc:creator>MioYasutake</dc:creator>
      <dc:date>2024-07-21T19:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13767050#M2029251</link>
      <description>&lt;P&gt;Task 6&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vineelaallamnen_0-1721610936047.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139531i20A0F2FDC0447C2F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vineelaallamnen_0-1721610936047.png" alt="vineelaallamnen_0-1721610936047.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 01:15:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13767050#M2029251</guid>
      <dc:creator>vineelaallamnen</dc:creator>
      <dc:date>2024-07-22T01:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Task 6 - API endpoint with payload required (July Developer Challenge - "Reverse APIs"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13767581#M2029255</link>
      <description>&lt;P&gt;Took some time troubleshooting but Passed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mxmw_0-1721641293342.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/139831iF7C50C32F79CED0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mxmw_0-1721641293342.png" alt="mxmw_0-1721641293342.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the fun challenges!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 09:41:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/task-6-api-endpoint-with-payload-required-july-developer-challenge-quot/m-p/13767581#M2029255</guid>
      <dc:creator>mxmw</dc:creator>
      <dc:date>2024-07-22T09:41:48Z</dc:date>
    </item>
  </channel>
</rss>

