コントラクトの追加および更新

10.0.6 /api/sam/v2/contracts.json API を使用してコントラクトを追加および更新します。

PUT 操作の機能

  • 要求はコントラクトを削除せず、コントラクトの購入注文またはソフトウェアへの割り当てを削除しません。データをデータベースの内容とマージします。
  • この操作は、ID でメトリックを照合し、メトリック ID が指定されていない場合はコード名によって照合します。メトリック ID が指定されていない場合、メトリック・コード名が見つからないと、新しいメトリックが作成されます。新しいメトリックの表示名は要求のコード名と同じです。
  • createSoftware パラメーターが true (createSoftware=true) に設定されていない限り、この操作によって新規ソフトウェアまたは発行者は作成されません。
  • この操作により、必要に応じて製品とメトリックの関係が追加されます。
  • この操作は、ID でコンピューター・グループを照合し、ID が指定されていない場合は名前によって照合します。ID も名前もない場合は、「すべてのコンピューター」グループが使用されます。コントラクトで使用できるのは「レポート」タイプのコンピューター・グループのみです。

HTTP 会話の例

PUT /api/sam/v2/contracts.json
要求本文で提供されるコントラクトを JSON 形式で追加または更新します (GET 要求の「rows」の下にある配列と同じ形式)
[
 {
   "contract_id":"CO1","name":"Contract1","type":2,"threshold":100,"metric":{"id":9,"code_name":"INTERNAL_INSTALL"},"computer_group":{"id":0,"name":"All Computers"}
  "purchase_orders":[{"purchase_number":"PO1","quantity":5000,"entitlement_start":"2021-08-03","entitlement_end":"2030-05-21"}
  {
   "purchase_number":"PO2","quantity":2,"entitlement_start":"2030-05-21"
   "entitlement_end":"2030-06-21"}],"software_products":
   [
   {"name":"Notepad++","publisher_name":"don.h@free.fr"}
   ]
  }
]

制限

注: この制限は、BigFix Inventory バージョン 10.0.6 で適用されます。
  • エラー・メッセージは、デフォルトで「Accept-Language」ヘッダーの下に表示される言語で表示されます。ユーザー・プロファイルで選択された言語は考慮されません。
  • カスタム・フィールド値は、整数タイプに対して「123」などのテキスト形式で指定する必要があります。これは他のフィールドには適用されません。
  • PUT 操作ではローマ文などの国別文字はサポートされません。このような文字を含むコントラクト・データを更新または追加するには、UI を使用して CSV インポートまたはインポートを使用します。コントラクトのインポートも参照してください。
  • BigFix Inventory バージョン 10.0.6 では、コントラクト・データ内の ASCII 文字のみが完全にサポートされます。この問題は、バージョン 10.0.7 以降は適用されません。BigFix Inventory 10.0.7 以降、非 ASCII 文字を含むソフトウェアはコントラクト REST API と UI の検索フィールドで受け入れられ、REST API のコントラクト名などのコントラクト・フィールドには非 ASCII 文字を含めることができます。

エラー・コード

CODUI4040E=A contract with the specified name and type already exists
CODUI4041E=Some of the selected products are not assigned to the selected metric
CODUI4042E=A contract with the specified contract ID already exists
CODUI4043E=Purchase order numbers are not unique in this contract
CODUI4044E=Element {0} is missing in this contract
CODUI4045E=Incorrect JSON format. An array is expected.
CODUI4046E=Incorrect JSON format. The element at row {0} is not an object.
CODUI4047E=Required field {0} is empty
CODUI4048E=Required field {0} at row {1} is empty
CODUI4049E=Contract custom field with ID {0} does not exist
CODUI4050E=Product and publisher pair at row {0} is not found. Creating software option is not enabled.
CODUI4051E=Metric ID is not found
CODUI4052E=Specified metric code name is invalid. The field must contain up to 254 characters and can contain only uppercase letters, numbers, and the following characters: "-_".
CODUI4053E=Computer group with ID {0} is not accessible to the user or target contract computer group does not exist
CODUI4054E=Ambiguous computer group name. More than one matching group is found.
CODUI4055E=Field {0} at row {1} is too long. The maximal length is {2}.
CODUI4056E=Format of custom field with ID {0} is incorrect. Expected type: {1}
CODUI4057E=Custom field with ID {0} is required
CODUI4058E=Invalid contract type. Correct values are: 1,2,3,4,5.
CODUI4059E=Invalid contract threshold. The value must be a positive integer.
CODUI4060E=Field {0} is too long. The maximum length should be {1}.
CODUI4061E=Specified purchase order quantity at row {0} is invalid. The value must be a positive integer or -1 for ELA.
CODUI4062E=Specified purchase order entitlement dates at row {0} are invalid. End date cannot be before start date.
CODUI4063E=Format of field {0} at row {1} is incorrect. Expected type: {2}.
CODUI4064E=Software name at row {0} is already used by IBM bundle.
CODUI4065E=Software name at row {0} is already used by a software version or release of the same publisher.
CODUI4066E=Software at row {0} cannot be assigned to both Unknown metric and another metric.
CODUI4067E=Specified metric code name is not allowed.
CODUI4068E=Specified computer group name is not accessible to the user or target contract computer group does not exist.
CODUI4098E=Data conversion error occurred at row {0}. Ensure all fields have expected data types.
CODUI4099E=Contract processing failed. The contracts have not been imported.

# For Contracts import from CSV
CODUI5040E=Incorrect number of columns at row {0}.
CODUI5041E=Invalid header: {0}.
CODUI5042E=Invalid number: {0} at row {1} in column {2}.
CODUI5043E=Missing required column: {0}.
CODUI5044E=All or none of the columns need to be provided: {0}.
CODUI5045E=The {0} column requires {1} column to be present.
CODUI5046E=Missing value at row {0} in column {1}.
CODUI5047E=Values need to be provided for all or none of {1} columns at row {0}.