Skip to content

Instantly share code, notes, and snippets.

@amusarra
Created March 19, 2014 23:25
Show Gist options
  • Save amusarra/9653785 to your computer and use it in GitHub Desktop.
Save amusarra/9653785 to your computer and use it in GitHub Desktop.
Test RESTful Service by cURL
$ curl -v http://localhost:8080/services/horses.xml | xmllint --format -
$ curl -v http://localhost:8080/services/horses.json | jsonlint -
##
# XML Output
##
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<horses>
<count>3</count>
<horse>
<age>9</age>
<chipId>430774604595270</chipId>
<colorMantle>Grigio</colorMantle>
<name>Shirus</name>
<type>Quarab</type>
</horse>
<horse>
<age>12</age>
<chipId>171643330950665</chipId>
<colorMantle>Morello</colorMantle>
<name>Macchia</name>
<type>Appalousa</type>
</horse>
<horse>
<age>13</age>
<chipId>725013209794106</chipId>
<colorMantle>Pezzato</colorMantle>
<name>Eclisse</name>
<type>Appalouse</type>
</horse>
</horses>
##
# JSON Output
##
{
"count": 3,
"horses": [
{
"age": "9",
"chipId": "430774604595270",
"colorMantle": "Grigio",
"name": "Shirus",
"owner": [],
"type": "Quarab"
},
{
"age": "12",
"chipId": "171643330950665",
"colorMantle": "Morello",
"name": "Macchia",
"owner": [],
"type": "Appalousa"
},
{
"age": "13",
"chipId": "725013209794106",
"colorMantle": "Pezzato",
"name": "Eclisse",
"owner": [],
"type": "Appalouse"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment