• 最終編集日時: 25 March 2021

フィールドAPI

フィールドAPIを使用して、フィールドおよび関連する(行)データを作成、更新、またはクエリします。

ファクトフィールドはファクトシートの列であり、イベントの他のフィールドと同様に、名前、式名、保持する値を指定するデータタイプがあります

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

フィールドAPIを使用して、フィールドデータを作成、更新、またはクエリします。これには、アクション(作成/更新/削除)を実行する特定のエンドポイントや、行に関連するデータが含まれます。

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

詳細については、 「インテグレーションのベストプラクティス 」を参照してください。

アクション

動詞 パス アクション 説明
取得 /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields インデックス ファクトシートに属するすべてのフィールドを取得するGetアクションを実行します。
投稿 /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields 作成 ファクトシートの1つ以上のフィールドを作成します。
プット /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields 更新 ファクトシートの1つ以上のフィールドを更新します。一括更新を実行できます。
削除 /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields 削除 ファクトシートの1つ以上のフィールドを削除します。 一括削除を実行できます。
取得 /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id} 表示 ファクトシートIDの個別のフィールドデータを表示します。 
プット /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id} 更新 フィールドIDを使用して1つのファクトシートIDの個別フィールドを更新します。
削除 /api/events/{event-id}/fact-sheets/{fact-sheet-id}/fields/{field-id} 削除 フィールドIDを使用して、1つのファクトシートIDの個別のフィールドを削除します。

要素

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

フィールド名 フィールドの説明 必須 一意ですか? 許容値 アウト* タイプ
ID

フィールドのID

  はい     はい 整数
序数 フィールドの序数値。         はい 整数
type フィールドのタイプ。 はい       はい string型
名前 フィールドの名前。 はい     はい はい 文字列
式名 フィールドの式名。       はい はい 文字列
説明 フィールドの簡単な説明。       はい はい 文字列
必須 フィールドの必須フラグ。       はい はい 文字列
小数点 数値フィールドの小数点以下の桁数       はい はい 文字列
入札者入力 これは、このフィールドが入札者によって入力されるべきかどうかを示します。       はい はい 文字列
オプション 多肢選択フィールドの場合のフィールドのオプション。       はい はい 文字列
識別 このフィールドを区別行に含める必要があるかどうか。       はい はい 文字列
式タイプフィールドのための式       はい はい 文字列
最小値 数値フィールドの最小値       はい はい 番号
最大値 数値フィールドの最大値とテキストフィールドの許容長。       はい はい 番号
除外リミット 上限と下限を含めるか除外するかを指定します。       はい はい 文字列
メモ

 応答ペイロードにnull値が表示されません。

この例では、Fields 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

サンプルのイベントID =とファクトシートID =に対して、以下のURL9219593444837772101にGETを実行しました 9220538753431210838。 

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

フィールドの回答の取得

{
		"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を使用してフィールドに対してアクションを実行する方法について説明します

作成

/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 "_". 

更新

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

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

To update one or more Fields at a time: 
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 Responseます。回答の本文には、作成された申請書が含まれます。失敗したリクエストは返 HTTP 400 Bad Requestされる。応答の本文には、XMLとしてフォーマットされた検証エラーが含まれます。

このページに表示されている一部、または全ての内容は、機械翻訳によるものです。ご了承ください。

関連アイテム


Coupa Core API

CoupaのRESTful APIは、お客様のデータをCoupaプラットフォームで読み取り、編集し、統合するための堅牢なアクセスを提供します。

APIの開始

Coupa APIの使用に関する一般情報、およびCSVの使用を検討するタイミング。

OAuth 2.0およびOIDCへの移行

Coupaは従来のAPIキーを廃止し、OAuth 2.0 / OIDCの使用を必要としています。R34以降、新しいAPIキーは発行されず、R35ではAPIキーはサポートされなくなります。

リソース

参照データ、トランザクションデータ、共有リソースなど、オブジェクトのタイプ別にAPIエンドポイントを整理しました。