フィールドAPI

ファクトフィールドはファクトシートの列であり、イベント内の他のフィールドと同様に、名前・数式名・および保持する値の型を指定するデータタイプを持ちます。

ファクトフィールドは、Excelワークシートのアイテムフィールドや列と同様に保持するデータを定義します。 各ファクト行には、データを効率的に使用できるようにするために、各ファクトフィールドに1つの値のみを含める必要があります。

フィールドAPIを使用して、フィールドデータの作成、更新、照会を行います。 これには、作成・更新・削除などの操作を行うための専用エンドポイントや、行に関連するデータも含まれます。

APIアクセス用のURLは次の通りです。https://<instance>.cso.coupahost.com/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

詳細については、統合のベストプラクティスを参照してください。

アクション

動詞

パス

アクション

Description

GET

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

インデックス

ファクトシートに属するすべてのフィールドを取得するためのGET操作を実行。

POST

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

作成

ファクトシートに対して1件または複数のフィールドを作成。

PUT

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

更新

ファクトシート内の1件または複数のフィールドを更新。 一括更新も可能です。

DELETE

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

delete

ファクトシート内の1件または複数のフィールドを削除。 一括削除も可能です。

GET

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id}

表示

指定したファクトシートIDの個別フィールドデータを表示。

PUT

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id}

更新

フィールドIDを使用して、指定されたファクトシートIDの個別フィールドを更新。

DELETE

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id}

delete

フィールドIDを使用して、1つのファクトシートIDの個々のフィールドを削除。

Elements

フィールドAPIで使用できる要素は次のとおりです。

フィールド名

フィールドの説明

必須

一意?

許容値

入力

アウト*

Type

ID

フィールドのID

はい

yes&#10;

整数

ordinal

フィールドの序数値。

yes&#10;

整数

タイプ

フィールドのタイプ。

yes&#10;

yes&#10;

文字列

名前

フィールドの名前。

yes&#10;

yes&#10;

yes&#10;

文字列

formula-name

フィールドの数式名。

yes&#10;

yes&#10;

文字列

説明

フィールドの簡単な説明。

yes&#10;

yes&#10;

文字列

必須

フィールドの必須フラグ。

yes&#10;

yes&#10;

文字列

少数

数値フィールドの小数点以下の桁数

yes&#10;

yes&#10;

文字列

bidder-input

このフィールドが入札者によって入力されるかどうかを示します。

yes&#10;

yes&#10;

文字列

options

複数選択フィールドの場合の選択肢。

yes&#10;

yes&#10;

文字列

distinguishing

このフィールドを行の識別に含めるかどうか。

yes&#10;

yes&#10;

文字列

formula

数式タイプフィールドの計算式。

yes&#10;

yes&#10;

文字列

min-value

数値フィールドの最小値

yes&#10;

yes&#10;

数字

max-value

数値フィールドの最大値およびテキストフィールドの許容最大長。

yes&#10;

yes&#10;

数字

exclude-limits

最大値・最小値の制限を含めるか除外するか。

yes&#10;

yes&#10;

文字列

注:

レスポンスのペイロードにはnull値は含まれません。

この例では、フィールドAPIに対してクエリを実行しました。

https://<instance>.cso.coupacloud.com/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

https://<instance>.cso.coupacloud.com/api/events/{event-id}/fact-sheets?name[contains]=factsheetname

サンプルのEvent-id = 9219593444837772101 とFact sheet id = 9220538753431210838について、GETメソッドを以下のURLで使用しました。

https://<instance>.cso.coupacloud.com/api/events/9220538753252871154/fact-sheets/9220538753431210838/fields

フィールドGETレスポンス

{ "total": 6, "fields": [ { "id": "9220538753431213703", "ordinal": 1, "type": "Text", "name": "name-fld", "formula-name": "name_fld", "description": "name field for api", "distinguishing": true }, { "id": "9220538753431215951", "ordinal": 2, "type": "Numeric", "name": "num-fld", "formula-name": "num_fld", "description": "number field", "decimals": 2, "distinguishing": false, "exclude-limits": false }, { "id": "9220538753431226586", "ordinal": 3, "type": "Binary", "name": "checkbox-demo", "formula-name": "checkbox_demo", "description": "checkbox demo field", "distinguishing": true }, { "id": "9220538753431234950", "ordinal": 4, "type": "Option", "name": "demo-multi-fld", "formula-name": "demo_multi_fld", "description": "demo multi fields", "options": { "default": 0, "values": [ { "name": "first", "value": 1.0 }, { "name": "second", "value": 2.0 }, { "name": "other", "value": 0.0 } ] }, "distinguishing": true }, { "id": "9220538753431237952", "ordinal": 5, "type": "Formula", "name": "demo-formula", "formula-name": "demo_formula", "description": "demo formula", "required": false, "distinguishing": false, "formula": "demo_factsheet.num_fld" }, { "id": "9220538753431240094", "ordinal": 6, "type": "StringFormula", "name": "demo-txt-formula", "formula-name": "demo_txt_formula", "description": "demo text formula field", "distinguishing": false, "formula": "demo_factsheet.name_fld" } ] }

作成/更新/削除

以下はCoupa APIを使ってフィールドに対してアクションを実行する方法の説明です

Create

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

以下のペイロードは、イベント( 9219593444837772101 およびファクトシートid = 9220538753431210838

Payload { "fields": [ { "type": "Text", "name": "name-fld-api", "formula-name": "name_fld-api", "description": "name field for api", "distinguishing": true } { "type": "StringFormula", "name": "demo-txt-formula-api", "formula-name": "demo_txt_formula_api", "description": "demo text formula field", "distinguishing": false, "formula": "demo_factsheet.name_fld_api" } ] } Response: 201 { "result": [ { "type": "api.post.added", "description": "2 objects created." } ], "added": 2, "fields": [ { "id": "9220538753532394472" } { "id": "9220538753530117686" } ] } Note: Formula field only takes "_".

Update

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

以下のペイロードは、フィールドを更新します。

一度に1つ以上のフィールドを更新するには: Payload: {"fields ": [{" id ": "9220538753530117686 "," type ": "Text "," name ": "name - fld - api - upd "," formula - name ": "name_fld_api - upd "," description ": "name field for api "," distinguishing ": false}, {"id ":" 9220538753532394472 ", "type ":" StringFormula ", "name ":" demo - txt - formula - api - upd ", "formula - name ":" demo_txt_formula_api_upd ", "description ":" demo text formula field update ", "distinguishing ": true," formula ": "demo_factsheet.name_fld_api_upd"}]} Response: 200 OK {"result ": [{" type ": "api.put.updated "," description ": "2 objects updated" } ], "updated": 2 }

削除

/api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields

上記のAPIを使用して、一度に複数のフィールドを削除できます。

Payload: { "fields": [ { "id": "9220538753530117686" }, { "id": "9220538753532394472" } ] } Response: 200 OK { "result": [ { "type": "fieldDeletionCompleted", "description": "The following fields were deleted: demo-txt-formula-api-upd, name-fld-api-upd. In total, 0 values were removed for these fields." } ], "deleted": 2 }
注:

更新は寛容に処理されます。つまり、1つのリソースの更新に失敗しても、他のリソースは成功する場合があります。 このペイロードでは、2つのフィールドを削除しています。 削除や更新を行うには、イベントIDが必須です。

要求が成功すると、 HTTP 200応答が返されます。 レスポンスの本文には作成された申請書が含まれます。 リクエストが失敗すると、次が返されます:

HTTP 400不正な要求

. レスポンスの本文にはXML形式の検証エラーが含まれます。