I was just looking at making a DirectAction to get a NSDict as a json output 
actually.

Searching for that it looked like ERRest was the answer, but maybe I should 
just “borrow” the method that actually generate the son response and stick with 
the regular DirectAction…

Xavier


> On 16 Apr 2020, at 20:11, Jesse Tayler <jtay...@oeinc.com> wrote:
> 
> I might be confused
> 
> Not sure this is the right API for what you want since this API is for a 
> specific page or object ID?
> 
> ra/Vote/2343.html
> 
> or
> 
> ra/User/jtayler.html
> 
> Is what I might expect
> 
> Those routes are HTML and either need default HTML or a static view page for 
> that entity that accepts an object to inspect.
> 
> Are you looking to invoke a list page?
> 
> This is a list with params and basically an apache rule redirects the URL 
> into the longer version and my app intercepts link URL requests and exchanges 
> links on production that are shorter.
> 
> http://planaby.com/event/nearby.html?distance=30.0&lat=40.7450127906344&lon=-73.9771424224899
> 
> or
> 
> http://planaby.com/person/1.html
> 
> Is just a simple ERRest route url translated by apache so it looks shorter in 
> production
> 
> Maybe that helps
> 
> 
> 
> 
>> On Apr 16, 2020, at 1:45 PM, Dev WO <webobje...@anazys.com> wrote:
>> 
>> Hi Jesse,
>> 
>> Thanks for the pointer, that does look better, but I don’t understand 2 
>> things:
>> The method I have is
>> actionUrlForEntity(WOContext context, String entityName, Object entityID, 
>> String action, String format, NSDictionary<String, Object> queryParameters, 
>> boolean secure, boolean includeSessionID)
>> I’m doing “ERXRouteUrlUtils.actionUrlForEntity(context(), "Status", null, 
>> null, null, restDict, false, false)"
>> 
>> I’m expecting a url like 
>> ''/cgi-bin/WebObjects/CloudManager.woa/ra/Status?type=heat”
>> but I get "/cgi-bin/WebObjects/CloudManager.woa/ra/statuses.html?type=heat”
>> I don’t really get why I got “statuses.html” instead of “Status” (the 
>> capital S and the plural+.html).
>> 
>> Looking at the source, it seems whatever I choose as “format”, I’ll get a 
>> “.something” appended, but the response is still ok if I do 
>> '/cgi-bin/WebObjects/CloudManager.woa/ra/Status.json?type=heat” so that’s 
>> not an issue.
>> 
>> But the capital S and the plural do break my call, any idea about this?
>> 
>> Thanks, hope everything is as good as it could be in NYC,
>> 
>> Xavier
>> 
>> 
>>> On 16 Apr 2020, at 18:49, Jesse Tayler <jtay...@oeinc.com> wrote:
>>> 
>>> 
>>> If you want to generate an action URL, I think you’ll want this API
>>> 
>>> String link = ERXRouteUrlUtils.actionUrlForEntity(context, entityName, 
>>> entityID, action, format, queryParameters, secure, includeSessionID);
>>> 
>>> 
>>> 
>>>> On Apr 16, 2020, at 12:42 PM, Dev WO via Webobjects-dev 
>>>> <webobjects-dev@lists.apple.com> wrote:
>>>> 
>>>> Hi everyone,
>>>> 
>>>> I’m currently trying a few things with ERRest.
>>>> In a stateless component, I need to create some urls manually (they will 
>>>> be used inside a script element).
>>>> When I was calling my DirectAction class, I was just doing this:
>>>> 
>>>>    context().generateRelativeURLs();
>>>> NSMutableDictionary<String, String> dict = new NSMutableDictionary<String, 
>>>> String>();
>>>> ...
>>>> dict.put(key, value);
>>>> ...
>>>> String relativeUrl = context()._directActionURL(“myDirectAction", dict, 
>>>> false);
>>>> 
>>>> 
>>>> But I wasn’t able to find out the equivalent _directActionURL() method to 
>>>> generate the Rest (with /ra) URL.
>>>> 
>>>> How would you manually generate a relative URL for an ERRest request?
>>>> 
>>>> Thanks a lot and stay safe,
>>>> 
>>>> Xavier
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com
>>>> 
>>>> This email sent to jtay...@oeinc.com
>>> 
>>> 
>> 
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to