Getting Started

Provides step-by-step instructions on how to use the COTOHA API (for Developers account).This page explains the procedures on how to start using COTOHA API. If you want to use "for Enterprise" environment please fill in the inquiry form.

STEP 01

Email Registration

Please register your account from the creating account page You will receive an email with an account registration URL in your email address.

STEP 02

User Registeration

Please access the URL and answer all the items. As you agree to the terms of use, and press the sign up button, you can complete the account creation.

STEP 03

Start it with Published Account Information

From the login page, log in to My Page and check the credentials required for your use such as Account Information.

STEP 04

Verifying the operation of the COTOHA API


CASE 01

Using Browsers to interact with API

The COTOHA API is REST compliant, making it easy to experiment with the REST client for browser extensions. See Qiita for instructions on using Firefox's Rest Client.

CASE 02

Using cURL to interact with API
(Mac, Linux, etc.)

cURL (client URL Library) is a general command line tools that can be used to access webAPI. This section describes the procedure for accessing COTOHA API using cURL command. First, use the authentication information displayed on your account page to get the access. You are required to obtain a new valid refreshed token every single day, since the access token valid only for 24 hours.

$ curl -X POST -H "Content-Type:application/json" -d '{
  "grantType": "client_credentials",
  "clientId": "[clientid]",
  "clientSecret": "[clientsecret]"
}' [Access Token Publish URL
]

If it succeded, you can obtain the following format of JSON files

{
  "access_token": "アクセストークン",
  "token_type": "bearer",
  "expires_in": "残り有効期限(秒)" ,
  "scope": "" ,
  "issued_at": "トークン発行日時(エポックタイムからの経過ミリ秒数)"
}

Call the API using the access token acquired. In this example, we call "Parsing API". Please use the URL shown on the account page after logging in as [Developer API Base URL]. The version in the URL is different for each API. Please specify a version witten on the reference page as [version] in the URL. (Example: v1, (β))

$ curl -H "Content-Type:application/json;charset=UTF-8" -H "Authorization:Bearer [access_token]" -X POST -d '{
"sentence": "昨日母と銀座で焼き肉を食べた"
}' "[Developer API Base URL]/nlp/v1/parse"

You will see the result bellow once you have completed the process.

{
  "result": [
    {
      "chunk_info": {
        "id": 0,
        "head": 4,
        "dep": "D",
        "chunk_head": 0,
        "chunk_func": 0,
        "links": []
      },
      "tokens": [
        {
          "id": 0,
          "form": "昨日",
          "kana": "サクジツ",
          "lemma": "昨日",
          "pos": "名詞",
          "features": [
            "日時"
          ],
          "dependency_labels": [],
          "attributes": {}
        }
      ]
    },
    {
...
*The for Developers environment has a limit of 1,000 calls per day per each API.
Details of each API can be found on the reference page. Reference