{"_id":"58c2e410258e5a1900b60b55","category":{"_id":"58c23c8b4922930f0050ac91","project":"55c8cff571d7580d0063a5e5","version":"57624356653c2d2200fec79c","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-03-10T05:41:31.448Z","from_sync":false,"order":1,"slug":"test","title":"API Tools"},"githubsync":"","project":"55c8cff571d7580d0063a5e5","__v":0,"user":"56f99ab84d2b4f3400edb636","version":{"_id":"57624356653c2d2200fec79c","__v":21,"project":"55c8cff571d7580d0063a5e5","createdAt":"2016-06-16T06:12:38.244Z","releaseDate":"2016-06-16T06:12:38.244Z","categories":["57624356653c2d2200fec79d","57624356653c2d2200fec79e","57624356653c2d2200fec79f","57624356653c2d2200fec7a0","57624356653c2d2200fec7a1","57624356653c2d2200fec7a2","57624356653c2d2200fec7a3","57624356653c2d2200fec7a4","57624356653c2d2200fec7a5","57624356653c2d2200fec7a6","57624356653c2d2200fec7a7","57624356653c2d2200fec7a8","57624356653c2d2200fec7a9","57624356653c2d2200fec7aa","5779ca1b99b40b0e005abb3a","5779d198aea88b0e00f63277","5797d3ab17ced017003c4be4","57ac170ef1cdae0e0053cdfc","57dbfc723ed3450e00dc9e6d","5804d12d16161c0f0077df9b","5841064b652e5b0f0015a7c8","588b5e5f2966b2230009cbf9","58a68ebf3239fa0f00857619","58c23c8b4922930f0050ac91","58fd1460809fc30f00f2ee07","5934eaf5328680002d77de6a","594bf91601cfe6000f40f4c5","595c4ed696b447001ba0cf6d","596524495cee50001575f5be","5970d4f1313162004dd303b5","59780fac24dbd1001a1fa057","59a8cfd3ead78a002d63cafe","59e0323d93da1f001c9ec170","5b0c16f2be9fcb0003e28222"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"4.0.0","version":"4"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-03-10T17:36:16.147Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"To complement our Phoenix API, a Command Line Interface (CLI) tool is provided so that users may run it via a Terminal.  The CLI tool is developed in Google Golang (Go) (https://golang.org) by using a Golang generated client defined with the Swagger's RESTful API Documentation Specification (http://swagger.io/specification). Reference to the link below for the Phone.com API Swagger Spec:\n\nhttps://github.com/phonedotcom/API-Swagger\n\nFor details of the CLI tool, reference to the link below:\n\nhttps://github.com/phonedotcom/API-Swagger/tree/master/phonecom-cli\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"API users with programming experiences may find our [Software Development Kit (SDK)](doc:sdk) useful.\",\n  \"title\": \"Software Development Kit (SDK)\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"How to use the CLI Tool\"\n}\n[/block]\n##Download:\nhttps://github.com/phonedotcom/API-Swagger/releases\n\n##Usage:\n\n      phonecom [global options] command [command options] [arguments...]\n\n      where \n          phonecom -h shows all the available options\n\nThe CLI Tool verifies API user authorization via the config.json file, the following file should be placed in the same folder as the CLI Tool.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"config\\\": [\\n    {\\n      \\\"type\\\" : \\\"main\\\",\\n      \\\"apiKeyPrefix\\\" : \\\"Bearer\\\",\\n      \\\"apiKey\\\" : \\\"Place Your API Access Token Here\\\",\\n      \\\"accountId\\\" : 123888\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"config.json\"\n    }\n  ]\n}\n[/block]\n##Example 1:\n\nList accounts\n\n      phonecom -c list-accounts        (response in brief description)\n      phonecom -c list-accounts --fl   (response in full description)\n      phonecom -c list-accounts --vrm  (response in verbose mode)\n\n##Example 2:\n\nSend a SMS\n\n      phonecom -c create-account-sms --to \"+17329910130\" --from \"+12014840800\" --text \"Hello CLI\"\n\n\n##Example 3:\n\nClick-to-call\n\n      phonecom -c create-account-calls -i createCalls.json\n\nwhere createCalls.json contains call info\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"account_id\\\": 123888,\\n\\t\\\"caller_phone_number\\\": \\\"+12014840800\\\",\\n\\t\\\"caller_extension\\\": 745234,\\n\\t\\\"callee_phone_number\\\": \\\"+17329910130\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"createCalls.json\"\n    }\n  ]\n}\n[/block]\n##Example 4:\n\nList the last 10 call entries\n\n      phonecom -c list-account-call-logs -i listCallLogs.json\n\nwhere listCallLogs.json contains call log info\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"account_id\\\": 123888,\\n\\t\\\"sort[created_at]\\\": \\\"desc\\\",\\n\\t\\\"limit\\\": 10,\\n\\t\\\"offset\\\": 0\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"listCallLogs.json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"command-line-interface-tool","type":"basic","title":"Command Line Interface (CLI) Tool"}

Command Line Interface (CLI) Tool


To complement our Phoenix API, a Command Line Interface (CLI) tool is provided so that users may run it via a Terminal. The CLI tool is developed in Google Golang (Go) (https://golang.org) by using a Golang generated client defined with the Swagger's RESTful API Documentation Specification (http://swagger.io/specification). Reference to the link below for the Phone.com API Swagger Spec: https://github.com/phonedotcom/API-Swagger For details of the CLI tool, reference to the link below: https://github.com/phonedotcom/API-Swagger/tree/master/phonecom-cli [block:callout] { "type": "info", "body": "API users with programming experiences may find our [Software Development Kit (SDK)](doc:sdk) useful.", "title": "Software Development Kit (SDK)" } [/block] [block:api-header] { "title": "How to use the CLI Tool" } [/block] ##Download: https://github.com/phonedotcom/API-Swagger/releases ##Usage: phonecom [global options] command [command options] [arguments...] where phonecom -h shows all the available options The CLI Tool verifies API user authorization via the config.json file, the following file should be placed in the same folder as the CLI Tool. [block:code] { "codes": [ { "code": "{\n \"config\": [\n {\n \"type\" : \"main\",\n \"apiKeyPrefix\" : \"Bearer\",\n \"apiKey\" : \"Place Your API Access Token Here\",\n \"accountId\" : 123888\n }\n ]\n}", "language": "json", "name": "config.json" } ] } [/block] ##Example 1: List accounts phonecom -c list-accounts (response in brief description) phonecom -c list-accounts --fl (response in full description) phonecom -c list-accounts --vrm (response in verbose mode) ##Example 2: Send a SMS phonecom -c create-account-sms --to "+17329910130" --from "+12014840800" --text "Hello CLI" ##Example 3: Click-to-call phonecom -c create-account-calls -i createCalls.json where createCalls.json contains call info [block:code] { "codes": [ { "code": "{\n\t\"account_id\": 123888,\n\t\"caller_phone_number\": \"+12014840800\",\n\t\"caller_extension\": 745234,\n\t\"callee_phone_number\": \"+17329910130\"\n}", "language": "json", "name": "createCalls.json" } ] } [/block] ##Example 4: List the last 10 call entries phonecom -c list-account-call-logs -i listCallLogs.json where listCallLogs.json contains call log info [block:code] { "codes": [ { "code": "{\n\t\"account_id\": 123888,\n\t\"sort[created_at]\": \"desc\",\n\t\"limit\": 10,\n\t\"offset\": 0\n}\n", "language": "json", "name": "listCallLogs.json" } ] } [/block]