Skip to content

Commit

Permalink
docs: api ref
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinthenight committed Mar 21, 2024
1 parent ca6b615 commit 8a62129
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/apiref/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Overview

| Description | Link |
| ------------ | --------------------------------- |
| API Base URL | `https://wavereport.mobingi.com/` |
48 changes: 48 additions & 0 deletions docs/apiref/prerequest.md
Original file line number Diff line number Diff line change
@@ -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 |
64 changes: 64 additions & 0 deletions docs/apiref/report.md
Original file line number Diff line number Diff line change
@@ -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` |
6 changes: 4 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ theme:
name: material
logo: assets/alphaus.png
favicon: assets/alphaus.png
font:
text: BIZ UDMincho
features:
- navigation.tabs
- navigation.sections
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8a62129

Please sign in to comment.