Skip to content

Instantly share code, notes, and snippets.

@nettofarah
nettofarah / gist:967894
Created May 12, 2011 03:48
Service Obsession
public class Product {
private String name;
private float price;
public Product(String name, float price){
this.name = name;
this.price = price;
}
// ... getters and setters
@nettofarah
nettofarah / gist:4059429
Created November 12, 2012 13:36
using 8tracks api
curl http://8tracks.com/mixes.xml?api_key=c7a7a9bf65499f2adb75cc9620ad7364106b86fa
- or -
curl --header "X-Api-Key=c7a7a9bf65499f2adb75cc9620ad7364106b86fa" http://8tracks.com/mixes.xml
@nettofarah
nettofarah / sample.xml
Created November 12, 2012 13:38
8tracks api xml response
<response>
<logged-in>false</logged-in>
<status>200 OK</status>
<page>1</page>
<per-page>8</per-page>
<errors nil="true"></errors>
<total-entries>99880</total-entries>
<mixes>
<mix>
...
@nettofarah
nettofarah / formats.sh
Created November 12, 2012 19:32
formats
curl http://8tracks.com/mixes.xml
curl http://8tracks.com/mixes.jsonp
curl http://8tracks.com/mixes?format=json
@nettofarah
nettofarah / response.xml
Created November 12, 2012 19:33
typical api response
<response>
<status>200 OK</status>
<errors nil="true"></errors>
<notices nil="true"></notices>
<logged-in>false</logged-in>
<page>1</page>
<per-page>15</per-page>
<total-entries>100</total-entries>
...
</response>
@nettofarah
nettofarah / dev_auth.sh
Created November 12, 2012 19:34
8tracks developer authentication
curl http://8tracks.com/mixes.xml?api_key=1234567890
- or -
curl --header "X-Api-Key: 1234567890" http://8tracks.com/mixes.xml
@nettofarah
nettofarah / good_password.sh
Created November 12, 2012 19:37
good password
curl --request POST -d "login=remitest&password=password" https://8tracks.com/sessions.xml
@nettofarah
nettofarah / good_password.xml
Created November 12, 2012 19:37
good password response
<response>
<user-token>1;123456789</user-token>
<current-user>
<slug>remitest</slug>
<location></location>
<popup-prefs>ask</popup-prefs>
<next-mix-prefs>ask</next-mix-prefs>
<avatar-urls>
<sq72>/images/avatars/sq72.jpg</sq72>
<sq100>/images/avatars/sq100.jpg</sq100>
@nettofarah
nettofarah / bad_password.sh
Created November 12, 2012 19:39
bad password
curl --request POST -d "login=remi&password=bad" https://8tracks.com/sessions.xml
@nettofarah
nettofarah / bad_password.xml
Created November 12, 2012 19:40
bad password response
<response>
<logged-in>false</logged-in>
<status>422 Unprocessable Entity</status>
<errors>Your login was unsuccessful</errors>
<notices nil="true"></notices>
</response>