atuttle
01/09/2023, 2:47 PMsatauros
01/09/2023, 3:56 PMresources
but endpoints
in my case (taffy 3.2.0).atuttle
01/09/2023, 5:54 PMatuttle
01/13/2023, 9:52 PMEvil Ware
02/11/2023, 3:27 AMatuttle
08/07/2023, 1:47 PMRay
08/17/2023, 5:55 AMcomponent extends="taffy.core.api" {
this.name="myRide";
variables.framework = { disableDashboard = true };
function onRequestStart(targetPath){
}
}
What stupid mistake am i making? I know its got to be very simple; but I worked on this a few months ago and couldn't get it then either...
@atuttle will you help me out if you have a moment?Ray
08/18/2023, 4:42 AMthisOldDave
08/23/2023, 9:48 AMthisOldDave
10/16/2023, 5:05 PMreturn rep(local.xml.toString()).withMime("application/xml")
do I really need a custom serializer?Slackbot
10/17/2023, 12:55 PMatuttle
12/12/2023, 1:25 PMivan
01/11/2024, 4:45 PM<cfcomponent extends="taffyAPI.base" taffy:uri="/v1/product">
<cffunction name="get" access="public" output="false">
<cfargument name="productId" required="true">
<cfreturn rep(arguments.productId).withStatus(200)>
</cffunction>
</cfcomponent>
I wanted to understand how to handle exceptions. If I call the endpoint without specifying the productId
, I get this error:
The parameter [productId] to function [get] is required but was not passed in.
How can I manage error messages in a more personalized way?
Thanks!Dana Kowalski
02/15/2024, 11:54 AM# Block bad bot
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^.(<|>|'|%0A|%0D|%27|%3C|%3E|%00). [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.(HTTrack|clshttp|archiver|loader|email|nikto|miner|python). [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.(winhttp|libwww\-perl|curl|wget|harvest|scan|grab|extract). [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(synapse).*$ [NC]
RewriteRule ^(.*)$ http://%{REMOTE_ADDR}/ [F,L]atuttle
02/15/2024, 10:03 PMatuttle
02/15/2024, 10:03 PMatuttle
02/15/2024, 10:05 PMatuttle
02/15/2024, 10:05 PMatuttle
02/15/2024, 10:05 PMatuttle
02/15/2024, 10:06 PMDana Kowalski
02/15/2024, 10:06 PMdavla
02/16/2024, 3:53 PMserializer = "serializers.CustomSerializer"
and CustomSerializer contains the following:
component extends="taffy.core.nativeJsonSerializer"
{
variables.AnythingToXML = application.AnythingToXML;
public any function getAsJSON() taffy_mime="application/json" taffy_default="true" {
return super.getAsJSON(variables.data); //variables.jsonUtil.serializeJson(variables.data);
}
public string function getAsXML() taffy_mime="application/xml" {
return variables.AnythingToXML.ToXML(variables.data);
}
}
As per the docs and examples I have set getAsJSON() as the taffy_default. The API now only returns XML unless I append .json onto the end of the url, i.e. https://api.domain.app/v3/public/jobs/1234 should return a JSON response and https://api.domain.app/v3/public/jobs/1234.xml should return an XML response but now the first returns XML and will only return JSON for this: https://api.domain.app/v3/public/jobs/1234.jsondavla
02/16/2024, 3:54 PMatuttle
02/16/2024, 3:54 PMatuttle
02/16/2024, 3:55 PMatuttle
02/16/2024, 3:56 PMStewart McGuire
02/26/2024, 3:09 AMdavla
02/28/2024, 12:14 PM.xml
onto the end of an api endpoint. How do I force JSON to be the default as it seems that XML is returned unless .json
is specified. This is my custom serializer component:
component extends="taffy.core.nativeJsonSerializer"
{
variables.AnythingToXML = application.AnythingToXML;
public any function getAsJSON() taffy_mime="application/json" taffy_default="true" {
return super.getAsJSON(variables.data);
}
public string function getAsXML() taffy_mime="application/xml" {
return variables.AnythingToXML.ToXML(variables.data,"post");
}
}
gamesover
04/05/2024, 4:35 PMsemver
update.) I may reattempt in the near future, but I don't have a lot of free time. Please review and let me know if this update would be beneficial.
https://github.com/atuttle/Taffy/pull/440
Another CF-centric approach would be to post the JSON back to the server to render the dump using CFDump (ie, to support Lucee's format or [cf_dump](https://github.com/kwaschny/cf_dump).)Anders Lars
04/23/2024, 7:07 PMvariables.framework = { disableDashboard = true };
I could do somethign brutal like make setupFramework public and add an argument to it for my framework settings, but that can't be the best option. any ideas?
Also as a general question in the application scope - application._taffy is all the configuration, whereas application.taffy is the actual taffy api object instance - is that right?