[prev in list] [next in list] [prev in thread] [next in thread]
List: forgerock-openidm
Subject: Re: [OpenIDM] OpenIDM Custom Endpoints Configuration Options
From: Jake Feasel <jake.feasel () forgerock ! com>
Date: 2016-06-14 22:11:51
Message-ID: CALXz=-W5fxvOWAMyk8bWCYpEYdL22uPf5gUKBN_vx4cXQHd9Og () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
The wrapping is based on the fact that your endpoint is getting interpreted
as a query request. You can avoid the wrapping by instead requesting it as
an action request; something like POST
/openidm/endpoint/myCustomEndpoint?_action=myAction
On Tue, Jun 14, 2016 at 2:54 PM, Greg Gebhart <
greg.gebhart@identityfusion.com> wrote:
> Hi,
>
> I'm working on a custom endpoint in OpenIDM to return an array of objects
> based upon a consumer's query request. Essentially they request some data
> from the custom endpoint, the endpoint calculates an array of objects, and
> the endpoint returns the array.
>
> The code looks something like this:
>
> if (request instanceof QueryRequest) {
> if (request.queryId == 'sampleData') {
> result = [];
> for (i = 0; i < 10; i++) {
> def optionCount = calculateDailyOptions(i) // Custom
> function
> def obj = ["day" : i, "count" : optionCount]
> result.push(obj)
> }
> return result;
> }
> }
>
> When the response is sent down to the consumer it gets wrapped in into
> another object that resembles something like
> {
> "result:[[obj1, obj2, obj3, ...]],
> "resultCount":10,
> "pagedResultsCookie":null,
> "totalPagedResultsPolicy":"NONE",
> "totalPagedResults":-1,
> "remainingPagedResults":-1
> }
>
> Is there anyway to configure the endpoint to NOT wrap the return value
> with the resultCount and paging parameters? From what I can tell these
> parameters are added after execution leaves the groovy script defined for
> the custom endpoint so I don't have direct control over them.
>
> Thanks,
> Greg
>
>
> _______________________________________________
> OpenIDM mailing list
> OpenIDM@forgerock.org
> https://lists.forgerock.org/mailman/listinfo/openidm
>
>
--
[image: ForgeRock] <http://www.forgerock.com/> *Jake Feasel*
Senior Software Developer | ForgeRock
*email* jake.feasel@forgerock.com <firstname.lastname@forgerock.com>
*web* forgerock.o <http://www.forgerock.com/>rg
[Attachment #5 (text/html)]
<div dir="ltr">The wrapping is based on the fact that your endpoint is getting \
interpreted as a query request. You can avoid the wrapping by instead requesting it \
as an action request; something like POST \
/openidm/endpoint/myCustomEndpoint?_action=myAction</div><div \
class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 2:54 PM, \
Greg Gebhart <span dir="ltr"><<a href="mailto:greg.gebhart@identityfusion.com" \
target="_blank">greg.gebhart@identityfusion.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm working on a \
custom endpoint in OpenIDM to return an array of objects based upon a consumer's \
query request. Essentially they request some data from the custom endpoint, the \
endpoint calculates an array of objects, and the endpoint returns the \
array.</div><div><br></div><div>The code looks something like \
this:<br></div><div><div><br></div><div>if (request instanceof QueryRequest) \
{</div><div> if (request.queryId == 'sampleData') {</div><div> <span \
style="white-space:pre-wrap"> </span>result = [];</div><div> <span \
style="white-space:pre-wrap"> </span>for (i = 0; i < 10; i++) {</div><div> \
def optionCount = calculateDailyOptions(i) // Custom function</div><div> <span \
style="white-space:pre-wrap"> </span>def obj = ["day" : i, \
"count" : optionCount]</div><div> <span \
style="white-space:pre-wrap"> </span>result.push(obj)</div><div> <span \
style="white-space:pre-wrap"> </span>}</div><div> <span \
style="white-space:pre-wrap"> </span>return result;</div><div> \
}</div><div>}</div></div><div><br></div><div>When the response is sent down to the \
consumer it gets wrapped in into another object that resembles something like <br \
clear="all"><div>{</div><div>"result:[[obj1, obj2, obj3, \
...]],</div><div>"resultCount":10,</div><div>"pagedResultsCookie": \
null,</div><div>"totalPagedResultsPolicy":"NONE",</div><div>" \
totalPagedResults":-1,</div><div>"remainingPagedResults":-1</div><div>}</div><div><br></div><div>Is \
there anyway to configure the endpoint to NOT wrap the return value with the \
resultCount and paging parameters? From what I can tell these parameters are added \
after execution leaves the groovy script defined for the custom endpoint so I \
don't have direct control over \
them.</div><div><br></div><div>Thanks,</div><div>Greg</div><div><br></div><div \
data-smartmail="gmail_signature"></div> </div></div>
<br>_______________________________________________<br>
OpenIDM mailing list<br>
<a href="mailto:OpenIDM@forgerock.org">OpenIDM@forgerock.org</a><br>
<a href="https://lists.forgerock.org/mailman/listinfo/openidm" rel="noreferrer" \
target="_blank">https://lists.forgerock.org/mailman/listinfo/openidm</a><br> \
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><table \
border="0" cellspacing="0" cellpadding="0" style="font-family:Times"><tbody><tr><td \
valign="top"><a href="http://www.forgerock.com/" target="_blank"><img \
src="http://www.cyphondesign.com/clients/forgerock/signature/images/FR_Sig_Logo.png" \
width="185" height="70" border="0" alt="ForgeRock"></a></td><td valign="top" \
align="left" bgcolor="#ffffff" \
style="font-family:arial,helvetica,verdana,sans-serif;font-size:11px;color:rgb(47,52,56);line-height:18.1499996185303px"><strong>Jake \
Feasel</strong><br>Senior Software Developer | ForgeRock<br><span \
style="color:rgb(127,183,170)"><strong>email</strong></span> <a \
href="mailto:firstname.lastname@forgerock.com" \
style="text-decoration:none;color:rgb(47,52,56)" \
target="_blank">jake.feasel@forgerock.com</a><br><span \
style="color:rgb(127,183,170)"><strong>web</strong></span> <a \
href="http://www.forgerock.com/" style="text-decoration:none;color:rgb(47,52,56)" \
target="_blank">forgerock.o</a>rg</td></tr></tbody></table></div></div> </div>
_______________________________________________
OpenIDM mailing list
OpenIDM@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openidm
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic