認証
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の詳細は、次を参照してください。