Subcommands

Let's say we want to get some reports about my account:

> motaword reports
Usage:
  motaword reports [command]

Available Commands:
  get-language-pairs-report Returns a report of language pairs.
  get-projects-report       Returns a report of corporate account users.
  get-users-report          Returns a report of corporate account users.

We now see the available commands under reports category. Let's use get-language-pairs-report subcommand:

> motaword reports get-language-pairs-report

{
  "meta": {
    "paging": {
      "links": {
        "next": null,
        "previous": null,
        "self": {
          "href": "https://api.staging.motaword.com/v0/reports/language-pairs"
        }
      },
      "page": 1,
      "per_page": 2,
      "total_count": 2
    }
  },
  "report": [
    {
      "language_pair": {
        "source_language": "af",
        "target_language": "ak"
      },
      "spending": "343.42",
      "word_count": "2475"
    },
    {
      "language_pair": {
        "source_language": "en-US",
        "target_language": "fr"
      },
      "spending": "11.70",
      "word_count": "195"
    }
  ]
}

Most commands will return a JSON response. By using a tool like jq, you can process these JSON responses. Here is an example for getting a human-readable output from the above response:

> motaword reports get-language-pairs-report \
| jq '.report[] | "For \(.language_pair.source_language) into \(.language_pair.target_language), we spent $\(.spending)"'


"For af into ak, we spent $343.42"
"For en-US into fr, we spent $11.70"