I just ran into a handy little utility: jsonpretty.
$sudo gem install json jsonpretty
While
$curl -i http://localhost:8081/openmrs-standalone/ws/rest/v1/catalog
gives you something like this:
{"catalog":[{"name":"Cohort","operations":[{"name":"GET http://localhost:8081/openmrs/ws/rest/v1/cohort?q","description":"Fetch all non-retired that match this parameter"},{"name":"GET http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}","description":"Fetch by unique uuid"},{"name":"GET http://localhost:8081/openmrs/ws/rest/v1/cohort","description":"Fetch all non-retired"},{"name":"POST http://localhost:8081/openmrs/ws/rest/v1/cohort","description":"Create with properties in request"},{"name":"POST http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}","description":"Edit with given uuid, only modifying properties in request"},{"name":"DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}?!purge","description":"Delete this object from the database"},{"name":"DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}?purge","description":"Delete this object from the database"}],"url":"http://localhost:8081/openmrs/ws/rest/v1/cohort","representations":[{"name":"ref","properties":["uuid","display","links"]},{"name":"default","properties":["uuid","name","description","voided","memberIds","links"]},{"name":"full","properties":["uuid","name","description","memberIds","voided","auditInfo","links"]}]},{"name":"CohortMember","operations":[{"name":"GET http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members/{uuid}","description":"Fetch by unique uuid"},{"name":"GET http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members","description":"Fetch all non-retired"},{"name":"POST http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members","description":"Create with properties in request"},{"name":"POST http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members/{uuid}","description":"Edit with given uuid, only modifying properties in request"},{"name":"DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members/{uuid}?!purge","description":"Delete this object from the database"},{"name":"DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{parentUuid}/members/{uuid}?purge","description":"Delete this object from the database"}],...
adding jsonpretty:
$curl -i http://localhost:8081/openmrs-standalone/ws/rest/v1/catalog | jsonpretty
gets you something much prettier:
{
"catalog": [
{
"name": "Cohort",
"operations": [
{
"name": "GET http://localhost:8081/openmrs/ws/rest/v1/cohort?q",
"description": "Fetch all non-retired that match this parameter"
},
{
"name": "GET http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}",
"description": "Fetch by unique uuid"
},
{
"name": "GET http://localhost:8081/openmrs/ws/rest/v1/cohort",
"description": "Fetch all non-retired"
},
{
"name": "POST http://localhost:8081/openmrs/ws/rest/v1/cohort",
"description": "Create with properties in request"
},
{
"name": "POST http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}",
"description": "Edit with given uuid, only modifying properties in request"
},
{
"name": "DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}?!purge",
"description": "Delete this object from the database"
},
{
"name": "DELETE http://localhost:8081/openmrs/ws/rest/v1/cohort/{uuid}?purge",
"description": "Delete this object from the database"
}
],
"url": "http://localhost:8081/openmrs/ws/rest/v1/cohort",
"representations": [
{
"name": "ref",
"properties": [
"uuid",
"display",
"links"
]
},
{
"name": "default",
"properties": [
"uuid",
"name",
"description",
"voided",
"memberIds",
"links"
]
},
{
"name": "full",
"properties": [
"uuid",
"name",
"description",
"memberIds",
"voided",
"auditInfo",
"links"
]
}
]
},
...
Nice! Thank you jsonpretty! 🙂