Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Dev WO via Webobjects-dev
I actually did like ERRest, but directly in my DirectAction public WOActionResults statusAsJsonAction() { //assuming dict exists ERXRestRequestNode restResponseNode = null; ERXRouteResults results = null; try {

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Jesse Tayler via Webobjects-dev
What I think you want is a DA to return JSON, perhaps like this: public WOResponse responseForPoint(DataPoint point) { ERXKeyFilter filter = DataPointController.showFilter(); String json = ERXRestFormat.json().toString(point, filter);

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Dev WO via Webobjects-dev
I cannot really say it is solved based on the subject of the thread, but regarding what I was actually trying to do, it is solved. I picked up just what was needed to generate the Json response in my DirectAction class so I could keep what I was using the generate the url. Thanks anyway, it

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Dev WO via Webobjects-dev
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

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Jesse Tayler via Webobjects-dev
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

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Dev WO via Webobjects-dev
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 queryParameters, boolean secure, boolean includeSessionID) I’m

Re: [ERRest] - Manually generating rest URL

2020-04-16 Thread Jesse Tayler via Webobjects-dev
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 > wrote: > > Hi

[ERRest] - Manually generating rest URL

2020-04-16 Thread Dev WO via Webobjects-dev
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();