Created
January 4, 2011 21:29
-
-
Save kpoon/765457 to your computer and use it in GitHub Desktop.
ColdFusion code to access the StatsMix API.
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
<!--- In the following example, user variables are indicated by uppercase (ex. API_KEY). ---> | |
<!--- To create a stat (POST) ---> | |
<cfhttp url="http://statsmix.com/api/v1/stats" method="post" charset="utf-8"> | |
<cfhttpparam type="url" name="api_key" value="API_KEY"> | |
<cfhttpparam type="url" name="value" value="VALUE"> | |
<cfhttpparam type="url" name="profile_id" value="PROFILE_ID"> | |
<cfhttpparam type="url" name="metric_id" value="METRIC_ID"> | |
<cfhttpparam type="url" name="generated_at" value="#DateFormat(Now(), "yyyy/mm/dd")# #TimeFormat(Now(), "HH:mm:ss")#"> | |
</cfhttp> | |
<cfswitch expression="#cfhttp.responseHeader.status_code#"> | |
<cfcase value="200"> | |
<!--- Good response, do nothing. ---> | |
</cfcase> | |
<cfdefaultcase> | |
<cfthrow message="Your call to StatsMix failed and returned an HTTP status of #cfhttp.responseHeader.status_code#."> | |
</cfdefaultcase> | |
</cfswitch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment