From 8a62129518b56e21c6d39fc7d44127db041a27a9 Mon Sep 17 00:00:00 2001 From: flowerinthenight Date: Thu, 21 Mar 2024 12:58:04 +0900 Subject: [PATCH] docs: api ref --- docs/apiref/index.md | 5 +++ docs/apiref/prerequest.md | 48 +++++++++++++++++++++++++++++ docs/apiref/report.md | 64 +++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 6 ++-- 4 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 docs/apiref/index.md create mode 100644 docs/apiref/prerequest.md create mode 100644 docs/apiref/report.md diff --git a/docs/apiref/index.md b/docs/apiref/index.md new file mode 100644 index 0000000..06b8272 --- /dev/null +++ b/docs/apiref/index.md @@ -0,0 +1,5 @@ +# Overview + +| Description | Link | +| ------------ | --------------------------------- | +| API Base URL | `https://wavereport.mobingi.com/` | diff --git a/docs/apiref/prerequest.md b/docs/apiref/prerequest.md new file mode 100644 index 0000000..c1076c1 --- /dev/null +++ b/docs/apiref/prerequest.md @@ -0,0 +1,48 @@ +# Pre-request + +open apiを使用するためのtokenを取得する必要があります。 + +**Response Format** + +``` +{ + token_type : string + expires_in : number + access_token : string +} +``` + +| Response value | type | description | +| -------------- | -------- | ----------- | +| `token_type` | _string_ | 認証スキーム | +| `expires_in` | _number_ | 期限 43200秒 | +| `access_token` | _string_ | token値 | + +## Token取得 + +openapiで使用するtokenを取得 + +**Request** + +```http +POST /v1/access_token HTTP1.1 +Content-Type: form-data + +{request body} +``` + +`{request body}` の例 + +```ruby +{ + "grant_type":"client_credentials", + "client_id":"test-client-id", + "client_secret":"ABCDEFGHI" +} +``` + +| Body | description | +| --------------- | ----------- | +| `grant_type` | 固定値 | +| `client_id` | 顧客ID | +| `client_secret` | 顧客Secret | diff --git a/docs/apiref/report.md b/docs/apiref/report.md new file mode 100644 index 0000000..9a4e19e --- /dev/null +++ b/docs/apiref/report.md @@ -0,0 +1,64 @@ +# Report + +**基本的なResponse Format** + +```javascript +{ + vendor : [ + { + id : string + name : string + date : [ + { + blended_cost : number + date : string + timestamp : number + true_unblended_cost : number + unblended_cost : number + },... + ] + },... + ] +} +``` + +| Response value | type | description | +| --------------------- | -------- | --------------------------------------------------- | +| `vendor` | _array_ | パラメーターで指定したvendor 例 : `aws` | +| `id` | _string_ | - `service` servicename - `account` account id | +| `name` | _string_ | - `service` servicename - `account` account name | +| `date` | _array_ | 取得したデータ一覧 | +| `date` | _string_ | - `monthly` : `YYYY-MM` - `daily` : `YYYY-MM-DD` | +| `timestamp` | _number_ | `date` のUNIXタイムスタンプ | +| `blended_cost` | _number_ | AWS CURの `lineitem/blendedcost` | +| `unblended_cost` | _number_ | AWS CURの `lineitem/unblendedcost` | +| `true_unblended_cost` | _number_ | mobingiで再計算したunblendedcost | + +## レポートの取得 + +**Request** + +```http +GET /v1/reports/{owner}/{resolution}?from={from}&to={to}&by={by}&vendor={vendor} HTTP1.1 +Content-Type: application/json +``` + +`{Path Variables}` の例 + +| Path | description | +| ------------ | -------------------------------- | +| `owner` | 使用可能な値 - `company` | +| `resolution` | 使用可能な値 - `monthly` - `daily` | + +`Request URL` の例 + +```ruby +GET /v1/reports/company/monthly?from=2019-01-01&to=2019-02-01&by=service&vendor=aws +``` + +| Params | description | +| -------- | ----------------------------------------------------------------------------------------------------------------- | +| `from` | 型 : _string_ フォーマット : _YYYY-MM\_DD_ 説明 : Monthly は自動的に `YYYY-MM`へ変換されます。 Daily は自動的に `YYYY-MM-DD`へ変換されます。 | +| `to` | 型 : _string_ フォーマット : _YYYY-MM\_DD_ 説明 : Monthly は自動的に `YYYY-MM`へ変換されます。 Daily は自動的に `YYYY-MM-DD`へ変換されます。 | +| `by` | **使用可能な値** 型 : _string_ - `service` - `account` | +| `vendor` | **使用可能な値** 型 : _string_ - `aws` | diff --git a/mkdocs.yml b/mkdocs.yml index 8e19aad..785ec3b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,8 +5,6 @@ theme: name: material logo: assets/alphaus.png favicon: assets/alphaus.png - font: - text: BIZ UDMincho features: - navigation.tabs - navigation.sections @@ -71,6 +69,10 @@ nav: - "aqua/recommendation.md" - "aqua/rightsizing.md" - "aqua/scheduling.md" + - "API": + - "apiref/index.md" + - "apiref/prerequest.md" + - "apiref/report.md" extra: alternate: