Skip to content

Instantly share code, notes, and snippets.

@cfjedimaster
Created February 22, 2013 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfjedimaster/5016327 to your computer and use it in GitHub Desktop.
Save cfjedimaster/5016327 to your computer and use it in GitHub Desktop.
<cfset restid = "...">
<cfset appid = "...">
<cfset dataUrl = "https://api.parse.com/1/classes/TipObject">
<cfset data = {"comments":"From CF","howdangerous":"3","numcows":"99"}>
<cfset jsonString = serializeJSON(data)>
<!---
Fix the damn JSON string
--->
<cfset jsonString = rereplace(jsonString,"cows"":([0-9]+)", "cows"":""\1""")>
<cfset jsonString = rereplace(jsonString,"rous"":([0-9]+)", "rous"":""\1""")>
<cfoutput>#jsonString#</cfoutput>
<cfhttp method="post" url="#dataUrl#">
<cfhttpparam type="header" name="X-Parse-Application-Id" value="#appid#">
<cfhttpparam type="header" name="X-Parse-REST-API-Key" value="#restid#">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="body" value="#jsonString#">
</cfhttp>
<cfdump var="#cfhttp#">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment