既存の REST CFC で新しい関数を作成しましたが、それを呼び出そうとすると、残りの関数が機能しているところで 404 エラーが発生します。すべての関数は、これからリンクしようとしているものと同じ構造に従っており、問題はありません。
私のような別の投稿を見ましたが、答えが見つかりませんでした。他の記事へのリンクはこちら
<cfcomponent restpath="student" rest="true">
<cffunction name="npssummary" access="remote" output="false" returntype="any" httpmethod="get" restpath="npssummary" produces="application/json">
<cfquery name="nps_summary" datasource="dpsigweb2">
select top 10 * from contact
</cfquery>
<cfreturn serializeJSON(nps_summary,"struct")>
</cffunction>
</cfcomponent>
そして、これが私がそれを呼んでいる方法です
<cfhttp url="http://dev.example.com/rest/IIT/student/npssummary" method="get">
<cfset results = "#cfhttp#">
<cfdump var="#results#">
ブラウザで関数を直接呼び出そうとすると、期待どおりの結果が得られます。
また、コンポーネントに変更を加えるたびに、この関数を使用して REST サービスをリセットしていますが、これまでのところ期待どおりに動作しているようです。
<cftry>
<cfset restInitApplication("Z:\Sites\testSites\API\","IIT")>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>