開発者API

nly.krのPDF保存機能をあなたのサービスに統合できます。
APIは doc_type=html または textのみをサポートし、タイプに応じて html_content または text_contentが必要です。

01 エンドポイント

POST https://nly.kr/api/pdf_save
Content-Type: application/x-www-form-urlencoded

02 認証

API呼び出し時の認証には、以下いずれかの方法でAPIキーを送信してください。

  • ヘッダー(推奨): X-API-Key: your_API_KEY
  • ヘッダー(代替): Authorization: Bearer your_API_KEY
  • フォームフィールド: api_key=your_API_KEY
  • 共通ヘッダー: Accept: application/json

ヒント: APIキーは マイページで確認・再発行できます。

03 パラメータ

フィールド 型 必須 説明
api_key 文字列 任意* APIキー(リクエストヘッダーでも送信可能)
doc_type 文字列 はい 文書タイプ: html または text (APIで利用できるのはこの2種類のみ)
doc_title 文字列 任意 文書タイトル(未入力時は既定値)
html_content 文字列 htmlの場合は必須 doc_type=htmlの場合は必須
text_content 文字列 textの場合は必須 doc_type=textの場合は必須
is_private 0|1 任意 公開設定(既定値 0=公開, 1=非公開)
password 文字列 非公開の場合は必須 is_private=1の場合は必須(パスワード)

※ api_keyはリクエストヘッダー(推奨)またはPOSTフィールドで送信できます。

04 レスポンス

成功(200 OK)

{
  "status": "success",
  "message": 「文書を保存しました。」,
  "share_url": "https://nly.kr/pdf/view/Ab3XkQ9Z",
  "code": "Ab3XkQ9Z"
}

エラー(4xx, 5xx)

{
  "status": "error",
  "message": 「APIではdoc_typeにhtmlまたはtextのみ指定できます。」
}
400 :Bad Request(パラメータ不足/形式エラー)
401 :Unauthorized(APIキーなし/無効)
405 : 許可されていないメソッド
500 : サーバーエラー

コード例 v1.0

# ========================= # 1) HTML保存(デフォルト: 公開) # - doc_type=html の場合は html_content を使用 # - is_private のデフォルト: 0(公開) # ========================= curl -sS -X POST "https://nly.kr/api/pdf_save" \\ -d "api_key=your_API_KEY" \\ -d "doc_type=html" \\ -d "doc_title=API HTMLテスト" \\ -d "is_private=0" \\ -d "password=" \\ --data-urlencode 'html_content=<h1>Hello</h1><p>API保存テスト</p>' # ========================= # 2) TEXT保存(デフォルト: 公開) # - doc_type=text の場合は text_content を使用 # ========================= curl -sS -X POST "https://nly.kr/api/pdf_save" \\ -d "api_key=your_API_KEY" \\ -d "doc_type=text" \\ -d "doc_title=API TEXTテスト" \\ -d "is_private=0" \\ -d "password=" \\ --data-urlencode 'text_content=こんにちは。\nPDFとして保存されるテキストです。' # ========================= # 3) 非公開(パスワード設定)例 # - is_private=1 の場合は password が必須 # ========================= curl -sS -X POST "https://nly.kr/api/pdf_save" \\ -d "api_key=your_API_KEY" \\ -d "doc_type=html" \\ -d "doc_title=非公開文書" \\ -d "is_private=1" \\ -d "password=1234" \\ --data-urlencode 'html_content=<h1>Private</h1><p>非公開文書</p>'

お困りですか?

API連携で問題があればいつでもお問い合わせください。

お問い合わせ →