メインコンテンツまでスキップ

Report Flow API - Getting Started

Report Flow APIへようこそ!このドキュメントでは、5分でPDF生成を始める方法を説明します。

⚡ 5分クイックスタート

ステップ1: APIキーを取得(1分)

Report Flow管理画面にアクセスして、以下の情報を取得します:

  1. ワークスペース設定API連携 へ移動
  2. 以下をコピー:
    • アプリケーションキー: ak_xxxxxxxxxxxxxxxx

ステップ2: デザインIDを確認(1分)

  1. デザイン管理 へ移動
  2. 使用するデザインを選択
  3. デザインID をコピー(例: 550e8400-e29b-41d4-a716-446655440000

ステップ2.5: パラメータ構造を確認(1分、オプション)

デザインが必要とするパラメータの構造を確認します:

curl -X GET https://api.re-port-flow.com/v1/file/design/parameter/550e8400-e29b-41d4-a716-446655440000 \
-H "appkey: your-app-key"

レスポンス例:

{
"customerName": "string",
"invoiceNumber": "string",
"amount": "number"
}
ヒント

パラメータ構造の詳細は デザインパラメータ取得ガイド を参照してください。

ステップ3: 最初のPDFを生成(3分)

以下のcURLコマンドをターミナルで実行します:

curl -X POST https://api.re-port-flow.com/v1/file/sync/single \
-H "Content-Type: application/json" \
-H "appkey: your-app-key" \
-d '{
"designId": "550e8400-e29b-41d4-a716-446655440000",
"version": 1,
"content": {
"fileName": "invoice.pdf",
"params": {
"customerName": "山田太郎",
"invoiceNumber": "INV-2024-001",
"amount": 10000
}
}
}' \
--output my-first-pdf.pdf
success

成功すると my-first-pdf.pdf がカレントディレクトリに保存されます!

🎯 主なユースケース

ユースケース1: 請求書の即時生成

ユーザーがボタンをクリックしたときに、即座にPDFをダウンロードさせる。

使用エンドポイント: 単一PDF同期生成

// ボタンクリック時
async function downloadInvoice(invoiceId) {
const pdf = await generatePDF({
designId: 'invoice-template',
version: 1,
fileName: `invoice_${invoiceId}.pdf`,
data: invoiceData
});

// ブラウザでダウンロード
downloadFile(pdf, `invoice_${invoiceId}.pdf`);
}

ユースケース2: 月次レポートの一括生成

毎月末に全顧客のレポートを一括生成してメール送信。

使用エンドポイント: 複数PDF非同期生成

// バッチ処理
async function generateMonthlyReports(customers) {
const contents = customers.map(customer => ({
fileName: `report_${customer.id}.pdf`,
params: customer.data
}));

const result = await generateMultiplePDFsAsync('report-template', contents);

// 各顧客にメール送信
await sendEmailsWithPDFs(result);
}

ユースケース3: プレビュー機能

デザインエディタでリアルタイムプレビュー。

使用エンドポイント: 単一PDF同期生成

// プレビューボタンクリック時
async function showPreview(designId, params) {
const pdf = await generatePDF({
designId,
version: 1,
fileName: 'preview.pdf',
data: params
});

// ブラウザで表示
openPDFInNewTab(pdf);
}

🧭 API概要

PDF生成エンドポイント

エンドポイント用途タイムアウトレスポンス
POST /file/sync/single単一PDF同期生成120秒PDFファイル
POST /file/async/single単一PDF非同期生成なしURL + fileId
POST /file/sync/multiple複数PDF同期生成120秒ZIPファイル
POST /file/async/multiple複数PDF非同期生成なしURL + fileId

その他のエンドポイント

エンドポイント説明
GET /file/download/{uuid}ZIP一括ダウンロード
GET /file/download/{uuid}/{fileId}個別ファイルダウンロード
GET /file/design/parameter/{designId}デザインパラメータ取得

🧪 Postmanで試す

APIをすぐに試したい場合は、公式のPostmanコレクションを使用できます:

Postman Public Workspace

Run in Postman

公式のPostmanコレクションには以下が含まれています:

  • ✅ 全7エンドポイントの実行可能なリクエスト
  • ✅ 認証設定(アプリケーションキー)の自動適用
  • ✅ 実行可能なサンプルパラメータ
  • ✅ レスポンス検証の自動テストスクリプト
  • ✅ エラーケース(412、401、400)のサンプル

📚 次のステップ

🔧 制限事項

詳細は 制限事項ページ を参照してください。

主な制限

  • リクエストサイズ: 最大50MB(Base64エンコード後、実質約37MB相当)
  • タイムアウト: 同期エンドポイント120秒、非同期は制限なし
  • Rate Limit: Workspace単位で適用(同期30 req/min、非同期100 req/min)
  • ファイル名: / \ : * ? " < > | および制御文字以外は使用可能
  • 認証: アプリケーションキー(appkey ヘッダー)が必須
  • HTTPS通信: 必須(HTTP通信は受け付けません)

💡 サンプルコード

JavaScript (Node.js)

import axios from 'axios';

async function generatePDF() {
const response = await axios.post(
'https://api.re-port-flow.com/v1/file/sync/single',
{
designId: '550e8400-e29b-41d4-a716-446655440000',
version: 1,
content: {
fileName: 'invoice.pdf',
params: {
customerName: '山田太郎',
invoiceNumber: 'INV-2024-001',
amount: 10000
}
}
},
{
headers: {
'appkey': 'your-app-key'
},
responseType: 'arraybuffer'
}
);

return response.data;
}

Python

import requests

def generate_pdf():
url = 'https://api.re-port-flow.com/v1/file/sync/single'
headers = {
'appkey': 'your-app-key',
'Content-Type': 'application/json'
}
data = {
'designId': '550e8400-e29b-41d4-a716-446655440000',
'version': 1,
'content': {
'fileName': 'invoice.pdf',
'params': {
'customerName': '山田太郎',
'invoiceNumber': 'INV-2024-001',
'amount': 10000
}
}
}

response = requests.post(url, headers=headers, json=data)
return response.content

🆘 サポート

質問やサポートが必要な場合は、以下までお問い合わせください: