汎用REST参照(標準UI駆動)

オーケストレート済システム用に構成するREST APIの例をいくつか見てみましょう。

アカウントの作成APIリクエスト・レスポンス

Create Account APIを構成するには、次の例を使用します。

アカウントAPI詳細の作成

  • 名前:ユーザーの作成
  • メソッド: POST
  • URL: <target-system>/admin/v1/Users
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、「統合設定」で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • REST APIのリクエスト本文

    例に示されているschemas属性:

    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
      "userName": "<EL>attributes.get('name').get(0)</EL>",
      "name": {
        "givenName": "<EL>attributes.get('firstName').get(0)</EL>",
        "familyName": "<EL>attributes.get('lastName').get(0)</EL>"
      },
      "password": "<EL>attributes.get('password').get(0)</EL>",
      "emails": [
        {
          "value": "<EL>attributes.get('email').get(0)</EL>",
          "type": "work",
          "primary": true
        }
      ]
    }
  • 応答
    {
      "items": "",
      "responseValues": [],
      "attributes": [
        {
          "name": "uid",
          "value": "<JP>$.id</JP>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        }
      ]
    }
    このAPIは、ターゲット・アカウントを作成し、返された識別子をuid属性にマップします。

グループ検索API

グループ検索アカウントAPI詳細

  • 名前:グループ検索(権限)
  • メソッド: POST
  • URL: <target-system>/admin/v1/Groups/.search
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、統合設定で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • REST APIのリクエスト本文

    例に示すschemas属性を含めます。

    {
      "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:SearchRequest"
      ],
      "attributes": [
        "displayName",
        "externalId"
      ],
      "sortBy": "displayName",
      "startIndex": "UQ:<EL>currentOffset</EL>",
      "count": "UQ:<EL>limit</EL>"
    }
  • 応答

    JSONエディタを使用して、次のレスポンスを使用します。

    {
      "items": "<JP>$.Resources[*]</JP>",
      "responseValues": [],
      "attributes": [
        {
          "name": "uid",
          "value": "<JP>$.Resources[<EL>currentIndex</EL>].id</JP>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        },
        {
          "name": "name",
          "value": "<JP>$.Resources[<EL>currentIndex</EL>].displayName</JP>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        }
      ]
    }

国検索API

  • 名前:国を検索
  • メソッド: GET
  • URL: <target-system>/admin/v1/AllowedValues/countries
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、統合設定で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • 応答

    JSONエディタを使用して、次のレスポンスを使用します。

    {
      "items": "<JP>$.attrValues[*]</JP>",
      "responseValues": [],
      "attributes": [
        {
          "name": "uid",
          "value": "<JP>$.attrValues[<EL>currentIndex</EL>].value</JP>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        },
        {
          "name": "name",
          "value": "<JP>$.attrValues[<EL>currentIndex</EL>].value</JP>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        }
      ]
    }

グループ・メンバーシップの追加API

  • 名前:グループ・メンバーシップの追加
  • メソッド: PATCH
  • URL: <target-system>/admin/v1/Groups/<EL>attributes.get('groups').get('uid').get(0)</EL>
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、統合設定で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • リクエスト

    次のリクエストを使用します。

    {
      "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
      ],
      "Operations": [
        {
          "op": "add",
          "path": "members",
          "value": [
            {
              "value": "<EL>attributes.get('uid').get(0)</EL>",
              "type": "User"
            }
          ]
        }
      ]
    }
  • 応答
    JSONエディタを使用して、次のレスポンスを使用します。
    Name: uid
    Value: <EL>attributes.get('uid').get(0)</EL>
    または、JSONエディタを使用します。
    {
      "items": "",
      "responseValues": [],
      "attributes": [
        {
          "name": "uid",
          "value": "<EL>attributes.get('uid').get(0)</EL>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        }
      ]
    }

アカウントAPIの削除

  • 名前:アカウントの削除API
  • メソッド: DELETE
  • URL: <target-system>/admin/v1/Users/<EL>attributes.get('uid').get(0)</EL>
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、統合設定で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • パラメータ: forceDelete: true
  • 応答

    次のレスポンスを使用します。

    Name: uid
    Value: <EL>attributes.get('uid').get(0)</EL>
    または、JSONエディタを使用します。
    {
      "items": "",
      "responseValues": [],
      "attributes": [
        {
          "name": "uid",
          "value": "<EL>attributes.get('uid').get(0)</EL>",
          "responseOfSubRequestId": null,
          "items": null,
          "subAttributes": []
        }
      ]
    }

パスワードの変更APIリクエスト・レスポンス

次の例は、アカウントのパスワード変更APIを構成する方法を示しています。「パスワードの変更API」オプションは、アカウントに__PASSWORD__システム属性が構成されている場合に使用できます。

  • 名前:パスワードの変更
  • メソッド: PUT
  • URL: <target-host>/admin/v1/UserPasswordChanger/<EL>attributes.get('uid').get(0)</EL>
  • ヘッダー
    • Content-Type: application/json
    • Authorization: <<CREDENTIALS>>. 値<<CREDENTIALS>>は、統合設定で構成されたOCI Vaultまたはユーザー入力資格証明を使用して実行時に解決されます。
  • リクエスト

    次のJSONリクエストを使用します:

    {
      "password": "<EL>attributes.get('password').get(0)</EL>",
      "schemas": [
        "<target-specific-schema>"
      ]
    }
    または、JSONエディタを使用してパスワードの変更APIを構成します
    {
      "id": "<UUID>",
      "name": "Change Password",
      "paginationType": "NONE",
      "method": "PUT",
      "url": "https://<target-host>/<change-password-endpoint>/<EL>attributes.get('uid').get(0)</EL>",
      "queryParameters": [],
      "headers": [
        {
          "name": "Content-Type",
          "value": "application/json"
        },
        {
          "name": "Authorization",
          "value": "<<CREDENTIALS>>"
        }
      ],
      "body": {
        "type": "JSON",
        "textBody": {
          "password": "<EL>attributes.get('password').get(0)</EL>",
          "schemas": [
            "<target-specific-schema>"
          ]
        }
      },
      "subRequests": []
    }
    URLおよびリクエスト本文は、ターゲット・アプリケーションによって公開されるパスワードの変更APIによって異なります。

レスポンス検証

APIのレスポンス検証式を定義して、ビジネス・ユース・ケースを検証し、2xxレスポンスが成功した操作を表しているかどうかを決定できます。

レスポンス検証は、HTTPステータス・コードに加えてレスポンス本文をチェックします。

たとえば、次のレスポンスを返すCreate Account APIについて考えてみます。

{
  "id": "12345",
  "userName": "jsmith"
}
ターゲット・アプリケーションから返されたユーザー名がリクエスト内のアカウント名と一致することを確認するには、レスポンス検証式で次を指定します:
<EL>attributes.get('name').get(0)</EL> === <JP>$.userName</JP> ? 'success' : 'Failure : Error creating users'
操作の実行後、レスポンス検証式が評価されます。式がsuccessを返す場合、操作は成功としてマークされます。それ以外の結果では、操作が失敗としてマークされ、返された結果が失敗メッセージとして使用されます。