[Coldbox-3.5] - SES and setNextEvent

I am trying to build APIs for my site and have the URL’s use SES instead of event=

The API works great but now my existing code that uses setNextEvent fails. It transforms my URL into SES but it doesn’t do it correctly.

Is there a way to have the SES transformation on only the /handlers/api directory? Or is there a different way of accomplishing this?

Here is my Routes.cfm

Look at this: https://coldbox.ortusbooks.com/content/full/event_handlers/relocating.html

As you can see from the doc above, the second param is specified for URL. Third is for URI, and so on.
You should include the argument name in your code. Like this:

setNextEvent(event=‘home.new’, queryString=‘id=#rc.id#’, xxxxx=false, yyyyy=‘var1,var2,var3’);

xxxxx and yyyyy - I am not sure which argument you are referring to.

xxxx is addToken (Whether to add the CF tokens or not)

yyyy is persist (A comma-delimited list of request collection key names tha will be persisted in the framework’s FLASH RAM and re-inflated in the next request)

I tried defining argument names but I still get the same result. My queryString is getting put in the URL.


Alternatively, you could do

setNextEvent(event=‘home/new?id=#rc.id#’, addToken=false, persist=‘var1,var2,var3’);


The problem was in the view. It wasn’t scoped correctly and once I made it rc.id it worked.

The issue I have now is that none of the images/js/css work. I can fix it by putting:

at the top of the view.

Is there a way to include it on all pages so that I don’t have to go through all individual views to add that one line?

You could place the base tag in the layout file.

In addition, the should be placed inside …. If you want to do it programmatically, ColdBox has HTML Helper to do that. Or, use ColdFusion tag, .


Excellent. Thanks for the help.