Apiman is a curl-like application that can be executed from the commandbox commandline.
box install commandbox-apiman
apiman <verb> <url>
Supported commandline flags
❯ apiman get https://jsonplaceholder.typicode.com/todos/1
{
"userId":1,
"id":1,
"title":"delectus aut autem",
"completed":false
}
If you need to pass query parameters you can either wrap the url in quotes to pass the query string or you may use the query
paraameter to pass a list of semicolon seperated parameters.
❯ apiman get "https://jsonplaceholder.typicode.com/comments?postId=1"
Can also be expressed as:
❯ apiman get -q "postId=1" https://jsonplaceholder.typicode.com/comments
[
{
"postId":1,
"id":1,
"name":"id labore ex et quam laborum",
"email":"[email protected]",
"body":"laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
},
{
"postId":1,
"id":2,
"name":"quo vero reiciendis velit similique earum",
"email":"[email protected]",
"body":"est natus enim nihil est dolore omnis voluptatem numquam\net omnis occaecati quod ullam at\nvoluptatem error expedita pariatur\nnihil sint nostrum voluptatem reiciendis et"
},
{
"postId":1,
"id":3,
"name":"odio adipisci rerum aut animi",
"email":"[email protected]",
"body":"quia molestiae reprehenderit quasi aspernatur\naut expedita occaecati aliquam eveniet laudantium\nomnis quibusdam delectus saepe quia accusamus maiores nam est\ncum et ducimus et vero voluptates excepturi deleniti ratione"
},
{
"postId":1,
"id":4,
"name":"alias odio sit",
"email":"[email protected]",
"body":"non et atque\noccaecati deserunt quas accusantium unde odit nobis qui voluptatem\nquia voluptas consequuntur itaque dolor\net qui rerum deleniti ut occaecati"
},
{
"postId":1,
"id":5,
"name":"vero eaque aliquid doloribus et culpa",
"email":"[email protected]",
"body":"harum non quasi et ratione\ntempore iure ex voluptates in ratione\nharum architecto fugit inventore cupiditate\nvoluptates magni quo et"
}
]
❯ apiman post http://localhost:8000/ui/auth/login -h "Content-Type=application/json" -d '{username : "admin", password : "commandbox" }'
{
"data":{
"isIdentified":true,
"user":"admin"
},
"error":false,
"pagination":{
"totalPages":1,
"maxRows":0,
"offset":0,
"page":1,
"totalRecords":0
},
"messages":[]
}
❯ apiman get https://api.stripe.com/v1/charges -u "YOUR_USERNAME_HERE"
{
"object": "list",
"count": 45,
"data": [
...
]
}