認証
Oracle Machine Learning ServicesのREST APIでは、トークンを使用してOracle Machine Learning Servicesユーザーを認証します。
Oracle Autonomous DatabaseからOracle Machine Learning RESTリソースにアクセスし、認証のために次の情報を指定する必要があります。
-
Oracle Machine Learningユーザー・アカウントのユーザー名とパスワード。
REST APIを使用してOracle Machine Learning Servicesにアクセスするには、アクセス・トークンを指定する必要があります。アクセス・トークンを認証および取得するには、-d
オプションを指定したcURLを使用して、Oracle Machine Learning User Management Cloud Service RESTエンドポイント/oauth2/v1/token
に対してOracle Machine Learning Servicesアカウントのユーザー名とパスワードを渡します。
Oracle Machine Learning User Management Cloud Service RESTエンドポイント/oauth2/v1/token
にリクエストを送信するcURLコマンドの例:
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json'
-d '{"grant_type":"password", "username":"'${username}'", "password":"'${password}'"}'
"<oml-cloud-service-location-url>/omlusers/api/oauth2/v1/token"
例では次の値が使用されています。
username
は、OML DEVELOPER
ロールを持つOracle Machine Learningユーザーのユーザー名です。password
は、ユーザー名のパスワードです。oml-cloud-service-location-url
は、テナンシID、データベース名、場所名を含むOracle Machine Learning User Management Cloud ServiceインスタンスURLのRESTサーバー部分を含むURLです。URLは、Oracle Autonomous Databaseインスタンスのサービス・コンソールの「データベース・アクション」の「関連サービス」セクションから取得できます。
ノート:
トークンの有効期限が切れると、OML ServicesのRESTエンドポイントへのすべてのコールは、HTTPエラー:HTTP/1.1 401 Unauthorized
とともにトークンの有効期限が切れたことを示すメッセージを返します
OAuth2 Authorizationの詳細は、次を参照してください。