Account
アカウントのAPIリファレンスは以下の通りです。
アカウントの作成
Role actions
ModifyAccount
Request
POST /accts HTTP1.1
Authorization: Bearer {token}
Content-Type: application/json
{request body}
以下に
{request body}
のリクエストペイロードの例を示します。{request body}
{
"vendor":"aws",
"customer_id":"012345678912",
"account_id":"919999618919"
"company_id":"AJfdivbDjhvbpE",
"name":"ripple customer1",
"note":null
}
{request body} description
Field | Type | Required | Validation | Description |
customer_id | string | Yes | - AWS 12桁 - Azure 16~36桁 | - AWS AccountID - Azure SubscriptionID |
account_id | string | Yes | - AWS 12桁 - AZURE 7桁 | - AWS PayerAccountID - Azure BillingID |
company_id | string | Yes | - | 請求グループ内部ID |
vendor | string | Yes | - サポート: aws ,azure | |
name | string | Yes | - 長さ: 3 ~ 100 | 登録する顧客名 |
note | string | No | - | 備考欄 |
Response
HTTP 200
{"status":"success"}
HTTP 400 customer id が既に登録されている場合
{
"code":"5005",
"message":"account function exception",
"description":"Customer id already exists."
}
Pythonでのサンプル
import requests
import json
def get_token():
# Note: you can see details https://docs.alphaus.cloud/v/api-reference/authentication
# Assign generated values for client_id and client_secret
params={
"grant_type": "client_credentials",
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"scope": "openid",
}
try:
response = requests.post(
url="https://login.alphaus.cloud/ripple/access_token",
headers={
},
params=params,
files=params,
)
except requests.exceptions.RequestException:
print('HTTP Request failed')
r = response.json()
return r['access_token'], r["token_type"]
def send_request(type, token):
# Authorization header
auth = type + " " + token
try:
response = requests.post(
url="https://api.alphaus.cloud/m/ripple/accts",
headers={
"Content-Type": "application/json;",
"Authorization": auth
},
data=json.dumps({
"account_id": "{account_id}",
"vendor": "{vendor}",
"customer_id": "{customer_id}",
"note": None,
"company_id": "{company_id}",
"name": "customer_name"
})
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
access_token, token_type = get_token()
send_request(token_type, access_token)
アカウントリストの取得
Role actions
ReadAccount
ModifyAccount
Request
GET /accts?vendor={vendor} HTTP1.1
Authorization: Bearer {token}