HTTP delete verb not being recognised

33 views
Skip to first unread message

Edward Chanter

unread,
Aug 20, 2015, 9:53:33 AM8/20/15
to taffy...@googlegroups.com
This is a weird one, I've got a "delete" method in my sources controller and I want to pass it a sourceid argument to delete a source from the database. The API is working perfectly with get and put requests but when I try this delete request I get:

"NetworkError: 405 Method Not Allowed"

The method looks like this:

<cffunction name="delete" hint="Remove a source from the database">
<cfargument name="sourceid" required="true" type="numeric"> 

<cfquery name="qGetUserId">
SELECT memberid
FROM apitokens
WHERE token = <cfqueryparam cfsqltype="cf_sql_varchar" value="#URL.deviceToken#">
</cfquery>
<cfquery>
UPDATE items
SET deletedat = '#DateFormat(Now(), "dd-mmm-yyyy")# #TimeFormat(Now(), "HH:MM:SS")#'
WHERE id = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.sourceid#">
AND createdby = <cfqueryparam cfsqltype="cf_sql_integer" value="#qGetUserId.memberid#"> 
</cfquery>
<cfset fResponse = {}>
<cfset fResponse.message = "Success">
<cfreturn representationOf( fResponse )>
</cffunction>

It must be something simple but I really can't see what I'm doing wrong, I've checked IIS7 to ensure that that all the necessary verbs are allowed, and they are.

Does anyone have ideas?

tottende...@gmail.com

unread,
Aug 20, 2015, 1:22:58 PM8/20/15
to Taffy Users, e...@cc.uk.com
What version of CF are you using?  I ran into a similar problem with ColdFusion 9 while implementing an external API on a site.  I ended up just writing a quick PHP script which used as a proxy to pass and return data.  

 I'm just researching taffy right now and haven't gotten to the point of writing code or testing anything.

Adam Tuttle

unread,
Aug 20, 2015, 5:18:22 PM8/20/15
to Taffy Users, e...@cc.uk.com
It's possible that there's some hardware in the middle (e.g. a router) that's blocking use of the DELETE verb.

Try sending a POST request with the header X-HTTP-METHOD-OVERRIDE: DELETE

This will tell Taffy that you want the request to be treated as if it were using the DELETE verb, even though it's a POST.

If that succeeds, then we know it's not your code or Taffy, but something between Taffy and your request (network hardware, iis, firewall, etc...)

Adam

On Thu, Aug 20, 2015 at 1:22 PM <tottende...@gmail.com> wrote:
What version of CF are you using?  I ran into a similar problem with ColdFusion 9 while implementing an external API on a site.  I ended up just writing a quick PHP script which used as a proxy to pass and return data.  

 I'm just researching taffy right now and haven't gotten to the point of writing code or testing anything.

--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Edward Chanter

unread,
Aug 21, 2015, 4:37:46 AM8/21/15
to Adam Tuttle, Taffy Users
Thanks Adam, I'll give that a go and let you know how I get on. 
--

Edward Chanter

Technical Innovations Manager
Collaborative Connections Ltd.
www.cc.uk.com

Landline: 01273 832221
Mobile: 07866 365282
Skype: edward.chanter
LinkedIn: http://goo.gl/Vdxqh
Twitter: @edthetechie

Reply all
Reply to author
Forward
0 new messages