
本ブログシリーズはSAP Graph Multi-Part Tutorial: Information Mapの日本語翻訳です。簡潔な翻訳のために、いくつかの細かいニュアンスは削ぎ落としています。最新の正しい情報は翻訳元やWhat’s New for SAP Graphをご参照ください。
インフォメーションマップ:SAP Graphチュートリアルシリーズ(日本語翻訳版)(オリジナル英語版)
パート1:SAP Graphのイントロダクション(日本語翻訳版)(オリジナル英語版)
パート2:はじめてのSAP Graphアプリ開発(日本語翻訳版)(オリジナル英語版) <-このブログ
パート3:SAP Graphにおける認証認可の実装(日本語翻訳版)(オリジナル英語版)
パート4:SAP Graphとプロトコル(日本語翻訳版)(オリジナル英語版)
パート5:SAP Graphと自前のデータの用意(日本語翻訳版)(オリジナル英語版)
パート6:SAP GraphでBusiness Data Graphを作成(日本語翻訳版)(オリジナル英語版)
パート7:SAP Graphにおけるキーマッピング(日本語翻訳版)(オリジナル英語版)
Thanks stephanie.lewellen and chaimbendelac for your cool blogs and for allowing me to translate!
{
"name": "hello-graph",
"version": "0.0.0",
"private": true,
"dependencies": {
"express": "4.17.1",
"node-fetch": "2.6.1",
"universal-cookie": "4.0.4"
}
}
npm install
const fetch = require("node-fetch");
class Graph {
async get(req, entity, params) {
const url = `https://sandbox.api.sap.com/sapgraph/${entity}${params ? `?${params}` : ""}`;
console.log(url) //for debugging
const options = {
method: "get",
headers:{
"Accept": "application/json",
"apiKey": "your APIkey"
}
};
const response = await fetch(url, options);
console.log(`${response.status} (${response.statusText})`) // for debugging
const json = await response.json();
return json;
}
}
module.exports = Graph;
const express = require("express");
const app = express();
const Graph = require("./graph");
const port = 3004;
const graph = new Graph();
app.get('/sap*', async (req, res) => {
const response = await graph.get(req, `${req.url}`, "");
res.send(`<pre><code>${JSON.stringify(response, null, 2)}</code></pre>`);
});
app.listen(port, () => { console.log(`Explore SAP Graph at http://localhost:${port}`) });
node hellograph.js
Explore SAP Graph at http://localhost:3004
http://localhost:3004/sap.graph/SalesQuote?$top=2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
21 | |
12 | |
12 | |
11 | |
10 | |
9 | |
9 | |
8 | |
7 | |
7 |