Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate Wufoo webhook with PUT request in ColdFusion
    text
    copied!<p>I'm having troubles with building correct <a href="http://wufoo.com/docs/api/v3/webhooks/put/" rel="nofollow">PUT request</a> to the Wufoo. </p> <p>In all my attempts I see the same error:</p> <p><code>404 A WebHook must contain a url parameter.</code></p> <p>Here is the version with JSON data type:</p> <pre><code>&lt;cfset local.action = "forms/#local.formHash#/webhooks.json" /&gt; &lt;cfset local.request = {"url" : local.webHookURL, "handshakeKey" : local.webHookKey} /&gt; &lt;cfset local.request["handshakeKey"] = local.webHookKey /&gt; &lt;cfhttp url="#local.baseURL##local.action#" method="put" username="#local.apiKey#" password="#local.apiPass#"&gt; &lt;cfhttpparam type="header" name="Content-Type" value="application/json; charset=UTF-8" /&gt; &lt;cfhttpparam type="body" value="#SerializeJSON(local.request)#" /&gt; &lt;/cfhttp&gt; </code></pre> <p>Same failure when using <code>file</code>:</p> <pre><code>&lt;cfset local.action = "forms/#local.formHash#/webhooks.json" /&gt; &lt;cfset local.request = {"url" : local.webHookURL, "handshakeKey" : local.webHookKey} /&gt; &lt;cffile action="write" file="#GetTempDirectory()#webhook.json" output="#SerializeJSON(local.request)#"&gt; &lt;cfhttp url="#local.baseURL##local.action#" method="put" username="#local.apiKey#" password="#local.apiPass#"&gt; &lt;cfhttpparam type="header" name="Content-Type" value="application/json; charset=UTF-8" /&gt; &lt;cfhttpparam type="file" mimetype="application/json" name="json" file="#GetTempDirectory()#webhook.json" /&gt; &lt;/cfhttp&gt; </code></pre> <hr> <p>UPDATE:</p> <p>To make the code working in ACF (my code works in Railo only) use this syntax for request:</p> <pre><code>&lt;cfset local.request = {} /&gt; &lt;cfset local.request["url"] = local.webHookURL /&gt; &lt;cfset local.request["handshakeKey"] = local.webHookKey /&gt; </code></pre> <p>Both methods should produce same JSON with case-sensitive keys.</p> <hr> <p>Also I've tried the XML data type:</p> <pre><code>&lt;cfset local.action = "forms/#local.formHash#/webhooks.xml" /&gt; &lt;cfsavecontent variable="putXML"&gt; &lt;cfoutput&gt; &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;WebHookPutRequest&gt; &lt;url&gt;#XMLFormat(local.webHookURL)#&lt;/url&gt; &lt;handshakeKey&gt;#XMLFormat(local.webHookKey)#&lt;/handshakeKey&gt; &lt;/WebHookPutRequest&gt; &lt;/cfoutput&gt; &lt;/cfsavecontent&gt; &lt;cffile action="write" file="#GetTempDirectory()#webhook.xml" output="#Trim(putXML)#"&gt; &lt;cfhttp url="#local.baseURL##local.action#" method="put" username="#local.apiKey#" password="#local.apiPass#"&gt; &lt;cfhttpparam type="header" name="Content-Type" value="application/xml; charset=UTF-8" /&gt; &lt;cfhttpparam type="body" value="#putXML#" /&gt; &lt;/cfhttp&gt; </code></pre> <p>Here I'm not sure if my XML is correct, though for JSON everything should be fine.</p> <p>Any ideas what's wrong with my code?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload