mauzer
06/20/2024, 1:46 PMmauzer
06/25/2024, 9:16 AM<cfcomponent extends="taffy.core.api">
<cfscript>
include "../config.cfm";
// Set global variables
application.apiSecret = variables.apiSecret;
application.issJWT = variables.apiName;
application.apiKey = variables.globalApikey;
mauzer
06/25/2024, 9:16 AMmauzer
06/27/2024, 8:04 AMmauzer
06/27/2024, 11:40 AMmauzer
07/01/2024, 10:36 AM{
"status_text": "OK",
"text": true,
"cookies": {
"COLUMNS": [
"name",
"value",
"path",
"domain",
"expires",
"secure",
"httpOnly",
"samesite"
],
"DATA": []
},
"errordetail": "",
"filecontent": "?xml version='1.0' encoding='UTF-8'?HITLISTTRANSACTION_TYPETYPELIST/TYPE/TRANSACTION_TYPEINDIVIDUALNAMEHayes, Jase Sims/NAMEID_ENTITY18333352/ID_ENTITYNPN001XYZ/NPNSTATE_RESIDENTOH/STATE_RESIDENTDATE_BIRTH01/02/1984/DATE_BIRTH/INDIVIDUAL/HITLIST",
"responseheader": {
"Date": "Mon, 01 Jul 2024 103116 GMT",
"Transfer-Encoding": "chunked",
"status_code": 200,
"Connection": "keep-alive",
"explanation": "OK"
},
"header": "HTTP/1.1 200 OK Date: Mon, 01 Jul 2024 103116 GMT Transfer-Encoding: chunked Connection: keep-alive ",
"statuscode": "200 OK",
"status_code": 200,
"http_version": "HTTP/1.1",
"mimetype": "application/xml"
}mauzer
07/01/2024, 1:12 PMmauzer
07/01/2024, 2:41 PMmauzer
07/02/2024, 11:58 AM<cffunction name="getAsJson" taffy:mime="application/json">
</cffunction>
<cffunction name="getAsXml" taffy:mime="application/xml">
</cffunction>
<cfcomponent extends="taffy.core.resource" taffy_uri="/pdb-reports-test/" >
<cffunction name="get" access="public" taffy:mime="application/json" output="false" hint="Get the Individual HitList">
<cfargument name="entity_id" type="string" required="true" default="" />
<cfargument name="report_type" type="string" required="true" default="1" />
<cfargument name="name_last" type="string" required="false" default="" />
<cfhttp method="get" result="resultData" timeout="60" throwOnError="yes" url="<https://api-xml-reports.com/pdb-xml-reports/list_xml.cgi?report_type=1&entity_id=18>">
<cfhttpparam name="Authorization" type="header" value="Basic #ToBase64("MAUROC:TEST12")#">
<cfhttpparam name="Content-Type" type="header" value="text/xml">
</cfhttp>
<cfreturn representationOf(resultData.filecontent).withStatus(200) />
</cffunction>
mauzer
07/02/2024, 12:00 PMatuttle
07/02/2024, 12:54 PMatuttle
07/02/2024, 12:55 PMmauzer
07/02/2024, 1:31 PMatuttle
07/02/2024, 1:31 PMreturn rep({ foo: "bar" });
and see how that works. if you’re getting an xml string out, it’s because you’re passing an xml string in.mauzer
07/02/2024, 1:32 PMmauzer
07/02/2024, 1:32 PMatuttle
07/02/2024, 1:32 PMmauzer
07/02/2024, 1:32 PMmauzer
07/16/2024, 10:34 AMaliaspooryorik
aliaspooryorik
mauzer
07/16/2024, 3:06 PMmauzer
07/16/2024, 3:07 PMaliaspooryorik
resultData.filecontent
is already JSON.mauzer
07/16/2024, 3:28 PMaliaspooryorik
<cfreturn representationOf(DeserializeJSON(resultData.filecontent)).withStatus(200) />
or you could use the taffy:mime
annotation to specify how you want it handledmauzer
07/16/2024, 3:32 PMtaffy:mime - where do I add that?
aliaspooryorik
mauzer
07/16/2024, 3:33 PMmauzer
07/16/2024, 3:35 PM