13
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HULFT10 for Containerが管理情報をAPIで操作できるようになった

Last updated at Posted at 2025-10-03

はじめに

HULFT10 for Container Services/Platform(以降HULFT Container版)のバージョン10.5.0が2025年10月3日にリリースされました。

10.5.0では管理情報を操作するAPIが使えるようになったので、使いどころや使い方を紹介していきたいと思います。

公開されたAPI

  • 配信管理情報
  • 集信管理情報
  • 詳細ホスト情報
  • ジョブ起動情報
  • 転送グループ情報
    上記の管理情報に対して以下の操作をするAPI
    • 一覧取得
    • 作成・更新
    • 取得
    • 削除

どんなメリットが?

HULFT Cotainer版はこれまで、管理情報に対する操作は、GUI上で手動実施する必要がありました。

それには以下のような問題があります。

  • 管理情報を大量に作成・更新したい場合、手間がかかる
  • 別環境のHULFT Container版に管理情報を複製できない
  • 管理情報の内容を確認する場合、目視確認するしかない

管理情報操作APIを使用することで以下のようなことができます。

  • スクリプトにAPI実行を組み込んで管理情報を大量作成できる
  • スクリプトのAPIのエンドポイントを切り替えて、複数環境に管理情報を複製できる
  • 管理情報が正しいか等のチェックをスクリプトで実施できる

管理情報操作APIの使い方

APIの実行には、実行環境のIPからの接続をHULFT Container側のリソースで許可する必要があります。
以下にリンクした公式マニュアルページの「HULFT10への接続を許可するIPリストの更新」を参照してください。
Container Services(EC2)
Container Services(fargate)
なお、Container Platformについては導入環境により異なります。

その前に..ログインAPI

管理情報操作APIの実行前にログインAPIを実行して認証情報を取得してください。

  • ログインAPI実行の例
curl -i -X POST -c /tmp/cookie.txt -H 'Content-Type: application/json' -d '{"user_id":"hoge","password":"foo"}' https://external-control-hoge.piyo.link/api/login

管理情報の作成(更新)

リクエストのボディに、管理情報に設定したい値を指定してください。
ボディのサンプルはHULFT公式マニュアルに記載されています。
配信管理情報の作成・更新のページリンク

  • 配信管理情報作成の例
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d '{"id":"LOOPBACK","meta":{"display_name":"loopback","comment":"sample comment","valid_term":{"start":"2025-10-03T03:04:05+09:00","end":"2025-10-04T03:04:05+09:00"},"accept_term":{"start":"03:04:05+09:00","end":"04:04:05+09:00"}},"authorities":[{"type":"user","name":"user_name","role":"owner"}],"file":{"name":"/tmp/snd/sample","type":"text","treat":"keep"},"code_conversion":{"side":"sending","own_code_set":"system","standard_for_japanese":"jis83","ebcdic_set":"auto"},"communication":{"transfer_group":"GROUPID","block_length":0,"block_count":0},"compression":{"type":"zstandard","mode":"standard"},"job":{"pre":"PRE_JOB","successful":"SUCCESS_JOB","unsuccessful":"UNSUCCESSFUL_JOB"},"security":{"password_type":"ascii","password":"paSSw0rd"}}' https://external-control-hoge.piyo.link/api/v1/managements/sendings/detail

ボディは別のファイルに記載して、それを参照するとコマンドがごちゃごちゃしません。

curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @snd.json https://external-control-hoge.piyo.link/api/v1/managements/sendings/detail

@snd.jsonにはボディを記載してください。
このままだと編集しにくいので改行とインデントを含めても大丈夫です。

{
  "id": "LOOPBACK",
  "meta": {
    "display_name": "loopback",
    "comment": "sample comment",
    "valid_term": {
      "start": "2025-10-03T03:04:05+09:00",
      "end": "2025-10-04T03:04:05+09:00"
    },
    "accept_term": {
      "start": "03:04:05+09:00",
      "end": "04:04:05+09:00"
    }
  },
  "authorities": [
    {
      "type": "user",
      "name": "user_name",
      "role": "owner"
    }
  ],
  "file": {
    "name": "/tmp/snd/sample",
    "type": "text",
    "treat": "keep"
  },
  "code_conversion": {
    "side": "sending",
    "own_code_set": "system",
    "standard_for_japanese": "jis83",
    "ebcdic_set": "auto"
  },
  "communication": {
    "transfer_group": "GROUPID",
    "block_length": 0,
    "block_count": 0
  },
  "compression": {
    "type": "zstandard",
    "mode": "standard"
  },
  "job": {
    "pre": "PRE_JOB",
    "successful": "SUCCESS_JOB",
    "unsuccessful": "UNSUCCESSFUL_JOB"
  },
  "security": {
    "password_type": "ascii",
    "password": "paSSw0rd"
  }
}

取得・削除・一覧取得

取得と削除はエンドポイントの末尾に取得・削除対象を付けます。

  • 配信管理情報取得の実行例(配信管理情報LOOPBACKの内容を取得)
curl -i -X GET -b /tmp/cookie.txt "https://external-control-hoge.piyo.link/api/v1/managements/sendings/detail/LOOPBACK"
  • 配信管理情報削除の実行例(配信管理情報LOOPBACKを削除)
curl -i -X DELETE -b /tmp/cookie.txt "https://external-control-hoge.piyo.link/api/v1/managements/sendings/detail/LOOPBACK"

一覧取得はエンドポイントの末尾にクエリパラメーターを指定することでフィルターや取得数を設定できます。

  • 配信管理情報一覧取得の実行例(オフセット5で3件の配信管理情報を取得)
curl -i -X GET -b /tmp/cookie.txt "https://external-control-hoge.piyo.link/api/v1/managements/sendings/list?limit=3&offset=5"

おまけ

  • 今回紹介したAPIまとめたシェル
#!/bin/bash

# お使いのHULFTのContainer版の管理コンテナのリンクに変更してください
export URI=https://external-control-hoge.piyo.link

echo login
# 使いのHULFTのContainer版のユーザーIDとパスワードに変更してください
curl -i -X POST -c /tmp/cookie.txt -H 'Content-Type: application/json' -d '{"user_id":"hoge","password":"foo"}' ${URI}/api/login
echo -e "\n----------------------------------------"

# このシェルと同じフォルダにルjsonファイルを作成してください
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @snd.json ${URI}/api/v1/managements/sendings/detail
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @rcv.json ${URI}/api/v1/managements/receivings/detail
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @host.json ${URI}/api/v1/managements/hosts/detail
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @job.json ${URI}/api/v1/managements/jobs/detail
curl -i -X POST -b /tmp/cookie.txt -H 'Content-Type: application/json' -d @transfer_group.json ${URI}/api/v1/managements/transfer-groups/detail
echo -e "\n----------------------------------------"

# 取得
# 取得したいファイルIDを指定してください
curl -i -X GET -b /tmp/cookie.txt "${URI}/api/v1/managements/sendings/detail/LOOPBACK"
echo -e "\n----------------------------------------"

# 一覧取得
# 条件を設定したいならクエリを設定してください
curl -i -X GET -b /tmp/cookie.txt "${URI}/api/v1/managements/sendings/list?limit=3&offset=1"
echo -e "\n----------------------------------------"

# 削除
# 削除したいファイルIDを指定してください
curl -i -X DELETE -b /tmp/cookie.txt "${URI}/api/v1/managements/sendings/detail/LOOPBACK"

echo -e "\n----------------------------------------"
echo logout
curl -i -X POST -b /tmp/cookie.txt ${URI}/api/logout
13
1
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?