For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/ja/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/ja/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/ja/sdk/api-custom-endpoints.md.
  • 🇯🇵 日本語
  • カスタムエンドポイントの作成

    Warning

    再作業中、納期未定。 Front App SDK (ReactJS) と Front API SDK (NodeJS) の両方が置き換えられます。このページは現在のリリースをドキュメント化し、置き換えが出荷されるまで正確で維持されます。これに対して書かれたコードは引き続き動作します。

    API に完全に新しい エンドポイント を作成することができます。

    新しいルートを追加する

    ./src/index.js

    
    const IAM = require('../forepaas/iam/IAM')
    
    /*
    We define an AuthInterceptor, that checks for user authentication, to be used in the new routes.
    Without adding it, the new routes will be publicly available.
    In the /qb/* endpoints the same mechanism is already done.
    */
    let AuthInterceptor = function (req, _res, next) {
        new IAM().checkSession(req, (err, session) => {
            if (err) {
                return next(err);
            } 
            req.authentication = {
                session
            }
            next();
        })
    }
    /*
    The SDK loads src/index.js, if present, and execute the exported function passing the "Express app".
    That gives an opportunity to add routes.
    */
    module.exports = (app) => {
        // this route checks for user authentication
        app.get('/hello/user', [AuthInterceptor], (req, res, next) => {
        res.ok({"hello": "user !"});
      });
      // this route will be public
      app.get('/hello/everyone', (req, res, next) => {
        res.ok({"hello": "world !"});
      });
    }

    注意:

    • SDK は Express を使用します
    • ./src/index.js ファイルが存在する場合、Express app を関数として実行するために渡されます
    • これにより、Express メソッドを使用して新しいルートを宣言できます
    • これらの実装で認証を処理するために必要です

    API を通じてファイルをアップロードする

    Multer のようなライブラリを使用して、同じメカニズムを使用できます。

    例えば、my-budget.csv を処理するには:

    const IAM = require('../forepaas/iam/IAM')
    const upload = multer()
    
    module.exports = (app) => {
      app.get('/send/budget', [AuthInterceptor, upload.single('budget')], (req, res, next) => {
        console.log(req.file)
        res.ok()
      })
    }

    その後、Front API からファイルを処理し、Lakehouse Manager バケット に保存し、Data Processing Engine ワークフローまたはアクションを起動できます!

    さらに詳しく

    当社のソリューションを実装するためのトレーニングや技術サポートが必要な場合は、営業担当者にお問い合わせください、またはこのリンクをクリックして、当社のプロフェッショナルサービスの専門家にプロジェクトのカスタム分析を依頼する見積もりを取得してください。

    Data Platform を構築するチームと直接質問し、フィードバックを共有し、相互作用するには、専用の Discord チャネル をご利用ください。

    OVHcloud サービスについてサポートが必要な場合は、ヘルプセンター でリクエストを作成してください。

    ユーザーコミュニティ に参加してください。