This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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