開始方法については、以下のセクションを参照してください。
API を使用する前に、AvePoint Online Services > システム管理 > アプリ管理 にアプリを登録し、アプリに権限を付与する必要があります。登録済みアプリでは、生成されたアプリケーション (クライアント) ID で認証を実行することができます。
アプリを登録するページにアクセスには、https://www.avepointonlineservices.com/app/registration/index をクリックしてください。
アプリの登録方法の詳細については、アプリの登録の構成 を参照してください。
アプリケーション (クライアント) ID を持っている場合、アプリケーション (クライアント) ID 経由でアクセス トークンを取得し、AvePoint Opus API で認証を行います。
アクセス トークンを取得するには、以下の情報が必要です。
要素 |
説明 |
Identity Service Address |
アイデンティティ サービス アドレスです。 • https://identity.avepointonlineservices.com |
AOSAppClientID |
取得したアプリケーション (クライアント) ID です。 |
ConnectorCertificateThumbprint |
AvePoint アプリの登録時に使用した .cer 証明書の .pfx 証明書ファイルの拇印です。 |
ConnectorScope |
AvePoint アプリに付与した権限です。 AvePoint Opus の場合、スコープは records.readwrite.all です。 |
上記の情報を使用してアクセス トークンを取得するには、先にクライアント ID と証明書を使用して JSON Web トークンを作成し、その JSON Web トークンを使用して AOS アイデンティティ サービスに定義された範囲のアクセス トークンを要求します。
アクセス トークンを取得する例としては、以下の通りです。
private static readonly string _IdentityServerAddress = "https://identity.avepointonlineservices.com";
private static readonly string _AosAppClientId = " ";
private static readonly string _ConnectorCertificateThumbprint = " ";
private static readonly string _ConnectorScope = "records.readwrite.all";
private void SendRquest() { var accessToken = GetAccessToken(); var requestUrl = "SubmitRecords POST URL"; var parameter = "SubmitRecords Parameter"; var reponse = WebUtil.SendRequestForIds("Post", requestUrl, accessToken, JsonConvert.SerializeObject(parameter)); }
private string GetAccessToken() {
var client = new HttpClient(); var disco = await httpClient.GetDiscoveryDocumentAsync(IdentityServerAddress);
var request = new ClientCredentialsTokenRequest { Address = disco.TokenEndpoint, ClientAssertion = new ClientAssertion { Type = OidcConstants.ClientAssertionTypes.JwtBearer, Value = CreateClientAuthJwt(disco, tenantId) }, Scope = _ConnectorScope, };
var tokenResponse = await httpClient.RequestClientCredentialsTokenAsync(request); return tokenResponse.AccessToken; }
private string CreateClientAuthJwt(DiscoveryDocumentResponse response) { var tokenHandler = new JwtSecurityTokenHandler { TokenLifetimeInMinutes = 10 };
var subject = new ClaimsIdentity(new List<Claim> { new Claim("sub", IdentityServerClientId), new Claim("jti", Guid.NewGuid().ToString()), });
var securityToken = tokenHandler.CreateJwtSecurityToken( issuer: _AosAppClientId, audience: response.TokenEndpoint, subject: subject, signingCredentials: new SigningCredentials(new X509SecurityKey(GetCertificate(_ConnectorCertificateThumbprint)), "RS256") ); return tokenHandler.WriteToken(securityToken); } |
*注意: 取得したトークンの有効期限は 1 時間です。有効期限が切れた場合は、トークンを再度取得する必要があります。
AvePoint Opus API を利用する際には、API URL が必要です。API URL は、データ センターによって異なります。データ センターに基づいて API URL を選択してください。
インフラストラクチャ |
データ センター |
Web API URL |
Microsoft Azure |
オーストラリア南東部 (ビクトリア) |
https://graph-au.avepointonlineservices.com/records |
カナダ中部 (トロント) |
https://graph-ca.avepointonlineservices.com/records | |
ドイツ中西部 (フランクフルト) |
https://graph-de.avepointonlineservices.com/records | |
米国東部 (バージニア) |
https://graph-us.avepointonlineservices.com/records | |
西日本 (大阪) |
https://graph-jp.avepointonlineservices.com/records | |
北ヨーロッパ (アイルランド) |
https://graph-ne.avepointonlineservices.com/records | |
東南アジア (シンガポール) |
https://graph-sg.avepointonlineservices.com/records | |
スイス北部 (チューリッヒ) |
https://graph-ch.avepointonlineservices.com/records | |
イギリス南部 (ロンドン) |
https://graph-uk.avepointonlineservices.com/records | |
米国バージニア州 (バージニア) |
https://graph-gov.avepointonlineservices.com/records | |
西ヨーロッパ (オランダ) |
https://graph-we.avepointonlineservices.com/records | |
フランス中部 (パリ) |
https://graph-fr.avepointonlineservices.com/records | |
韓国中部 (ソウル) |
https://graph-kr.avepointonlineservices.com/records | |
Google Cloud Platform
|
オーストラリア南東部 (シドニー): australia-southeast1 |
https://graph-gcp-au.avepointonlineservices.com/ |
日本 (東京): asia-northeast1 |
https://graph-gcp-jp.avepointonlineservices.com/ | |
米国東部 (モンクス コーナー): us-east1 |
https://graph-gcp-us.avepointonlineservices.com/ | |
西ヨーロッパ (エームスハーフェン、オランダ): europe-west4 |
https://graph-gcp-we.avepointonlineservices.com/ |