基本

文字コード

基本的に文字コードはUTF-8

プロトコルとレスポンス

APIへのアクセスはすべてHTTPSで行います。レスポンスはJSONで行います。

Parameter形式

Get リクエスト

Post,Putリクエスト

application/json

もしくは

application/x-www-form-urlencoded

File APIの形式

multipart/form-data

Errorレスポンス

リクエストに対して処理が行えない場合、HTTPステータスで400番台および500番台のエラーを返します。

Not Found

 HTTP/1.1 404 NotFound
 Content-Type: application/json; charset=utf-8
{
  "success": false,
  "message": "Page not Found",
  "error_code": 404
}

Access Denied

 HTTP/1.1 403 AccessDenied
 Content-Type: application/json; charset=utf-8

{"message":"Problems parsing JSON"}

UnAuthorized

 HTTP/1.1 401 Unauthorized
 Content-Type: application/json; charset=utf-8
{
  "success": false,
  "message": "Requires authentication",
  "error_code": 401
}

Validation Error

データの作成/更新APIにおいて、不正なデータが含まれている場合、422 Unprocessable Entityを返します。

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
{
  "message": "Validation Fail",
  "error_code": 201,
  "success": false,
  "errors": {
    "name": "can't be blank"
  }
}

Pagination

一覧を取得するAPIはデフォルトで30個しか返しません。pageパラメータを設定する事で次のページの要素を取得する事ができます。 また、per_pageパラメータを設定する事で一度に取得する要素数を変更する事ができます。(最大per_page=100)

$ curl  https://biz.conyac.cc/api/v1/my/questions?page=4&per_page=100&access_token=dec0c0dc2f72e9d67075d136409bf33a21b6cb8097634d328447a7672b2969ac