Skip to content

Instantly share code, notes, and snippets.

@tmarkiewicz
Created January 3, 2011 22:05
Show Gist options
  • Save tmarkiewicz/764059 to your computer and use it in GitHub Desktop.
Save tmarkiewicz/764059 to your computer and use it in GitHub Desktop.
Example Curl usage for the StatsMix API.
Curl is the easiest way to get started with the StatsMix API. Full documentation on how to use curl can be found here: http://curl.haxx.se/docs/manpage.html
In the following examples, user variables are indicated by uppercase (ex. API_KEY). Date values should be specific in the following format: YYYY-MM-DD (ex. 2010-02-22)
Create a stat (POST):
curl -H "X-StatsMix-Token: API_KEY" -d "value=VALUE&profile_id=2&metric_id=1&generated_at=2010-02-22" statsmix.com/api/v1/stats
--or--
curl -d "value=VALUE&profile_id=PROFILE_ID&metric_id=METRIC_ID&generated_at=2010-02-22&api_key=API_KEY" statsmix.com/api/v1/stats
Show a stat (GET):
curl -H "X-StatsMix-Token: API_KEY" -G statsmix.com/api/v1/stats/STAT_ID.xml
Update a stat (PUT):
curl -H "X-StatsMix-Token: API_KEY" -d "value=VALUE&profile_id=PROFILE_ID&metric_id=METRIC_ID" -X PUT statsmix.com/api/v1/stats/STAT_ID
Delete a stat (DELETE):
curl -H "X-StatsMix-Token: API_KEY" -X DELETE statsmix.com/api/v1/stats/STAT_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment