• 最終編集日時: 05 August 2021

POとPO変更をERPに統合

Coupa POとPOの変更をERPに統合する手順を追った説明。

はじめに

このドキュメントはMicrosoft Word文書(Coupa発注書からERP.docx)としてダウンロードすることもできます。

一般的なAPI設定の考慮事項

限定されたペイロード – フィールドとAPIフィルター

CoupaのAPIは、デフォルトで多くのデータを返します(例:関連オブジェクトとしての全オブジェクト)。APIが返すペイロードは非常に大きくなる、したがって処理が遅くなる可能性があります。これは、リソースの無駄遣いは言うまでもなく、無関係なデータを必要としないお客様にとって問題となる可能性があります。

Coupaには、オブジェクトのスキーマ全体とすべての関連付けの代わりに、限定されたJSONまたはXML応答を返す「フィールド」パラメーターとAPIフィルターの概念があります。

この記事で説明する使用例

このドキュメントでは、ERPの発注書番号がCoupa発注書番号によって決定されることを前提としています。 この記事では、Coupa発注書をERPに統合するための3つの異なるオプション(作成と更新の両方)について説明します。 

これらのオプションにより、Coupaからインテグレーションを監視する方法が変更されます。

3つのオプションの場合、Coupa POはエクスポートフラグに基づいてERPにプッシュされます。

POのインテグレーションでエラーが発生した場合、Coupa UIのPOで手動の変更が必要になります。この変更によりエクスポートフラグがリセットされるため、次の実行でPOが検討されます

ヒント

Coupaは、Coupaサポートに「変更のたびに最後にエクスポートしたPOをリセットする」というオプションを有効にするよう提案します。 この設定はUIにのみ適用されます。APIで行われた変更は、エクスポート済みステータスを変更しません。

APIの専用インテグレーションと連絡先を作成

オプション2および3の場合、次を作成する必要があります。

  1. 実装するAPIオーケストレーションごとに専用のインテグレーション
    integration-01.png
  2. インテグレーションに失敗した場合にアラートを受け取る、インテグレーションごとに1つまたは複数のインテグレーション連絡先
    integration-02.png
ヒント

Coupaでは、Coupaサポートに連絡して、[ドキュメントタイプ別インテグレーション履歴へのリンクを有効にする]オプションを有効にするよう提案しています。 この設定により、設定ページにリンクが追加され、ドキュメントタイプごとに完全なインテグレーション履歴が表示されます

オプション1:カスタムフィールドに基づくシンプルな監視

説明

このシナリオでは、POごとに、1つまたは複数のPOヘッダーカスタムフィールドに現在のインテグレーションステータスを追加します。という名前のカスタムフィ cf-integration-status ールドを追加しましたIntegration Status。標準発注書データテーブルを使用して、次のURLでドキュメントのインテグレーションステータスを確認しますhttps://<your instance hostname>/order_headers

po-integration-01.png

オーケストレーション図

po-orchistration.png

ステップ/ APIコールの詳細

手順1

ERPで作成/更新するCoupa発注書のリストと詳細を取得します。
選択基準には、[エクスポートフラ グ]と[POステータス ] が含まれます。
ERPでPOの更 新を処理するには、クエリパラメーターshow_deleted _linesが必要になる場合があります

方法

取得

API

https://<your instance hostname>/api/purchase_orders/

クエリパラメーター

filter=<your API filter name>
offset=10
exported=false
show_deleted_lines=true*
status[in]=issued,canceled,closed

サンプルURL

https:///api/purchase_orders?filter=&offset=10&exported=false&show_deleted_lines=true&status[in]=issued,cancelled,closed

クエリ本文のサンプル

該当なし

返答本文のサンプル

step-1.png

メモ

* = show_deleted_lines=trueはPO変更用

手順2

個別のPOをエクスポート済みとしてマーク

方法

プット

API

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>

クエリパラメーター

exported=true
fields=["id","exported"]

サンプルURL

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>?exported=true&fields=["id","exported"]

クエリ本文のサンプル

該当なし*

返答本文のサンプル


{
	"id": <Purchase Order id>,
	"exported": true
	}
メモ

*この呼び出しでは、URLに「?exported=true」を含める場合、ペイロードは必要ありません。 そこで、ERPでPOの作成/更新が行われます。
 

手順3

レポート用のカスタムフィールドを更新する

方法

プット

API

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>

クエリパラメーター

fields=["id","exported",{ "custom_fields": {} }]

サンプルURL

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>?fields=["id","exported",{ "custom_fields": {} }]

クエリ本文のサンプル


{ "custom-fields": {
		"<your custom-field name>": "Success: The PO was properly replicated in your ERP"
}}

または


{ "custom-fields": {
		"<your custom-field name>": "Error: The PO was properly replicated in your ERP"
}}

返答本文のサンプル


{ "id": <Purchase Order id>,
		"exported": true,
		"custom-fields": {
				"<your custom-field name>": "Success: The PO was properly replicated in your ERP"
}}

または


{ "id": <Purchase Order id>,
		"exported": true,
		"custom-fields": {
				"<your custom-field name>": "Error: The PO was properly replicated in your ERP"
}}

オプション2:インテグレーション履歴を使用した高度な監視

説明

このシナリオでは、POごとに次を実行します。

  • ドキュメントの以前のインテグレーション履歴記録を解決します
  • インテグレーション履歴記録を作成
  • エラーが発生した場合のインテグレーション連絡先へのアラートを作成する

各ドキュメントには、インテグレーション履歴の詳細が含まれています。

 po-history-01.png

po-history-02.png

標準のPOインテグレーション履歴データテーブルを使用して、ドキュメントのインテグレーションステータスを確認します。次のサイトで確認できますhttps://<your instance hostname>/integration_history_records/purchase_orders

po-int-records-01.png

応答コードのフィルターを使用して、正常にレプリケートされたドキュメントと失敗したドキュメントを区別できます。

po-int-records-02.png

オーケストレーション図

po-int-orchistration.png

ステップ/ APIコールの詳細

手順1

ERPで作成/更新するCoupa発注書のリストと詳細を取得します。
選択基準には、[エクスポートフラ グ]と[POステータス ] が含まれます。
ERPでPOの更 新を処理するには、クエリパラメーターshow_deleted _linesが必要になる場合があります

方法

取得

API

https://<your instance hostname>/api/purchase_orders/

クエリパラメーター

filter=<your API filter name>
offset=10
exported=false
show_deleted_lines=true
status[in]=buyer_hold,issued,canceled,closed,soft_closed

サンプルURL

https://<your instance hostname>/api/purchase_orders?filter=<your API filter name>&offset=10&exported=false&show_deleted_lines=true&status[in]=buyer_hold,issued,canceled,closed,soft_closed

クエリ本文のサンプル

該当なし

返答本文のサンプル

step-2.png

 

手順2

個別のPOをエクスポート済みとしてマーク

方法

プット

API

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>

クエリパラメーター

exported=true
fields=["id","exported"]

サンプルURL

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>?exported=true&fields=["id","exported"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


{
		"id": <Purchase Order id>,
		"exported": true
}

ここで、ERPでのPOの作成/更新が行われます。

手順3a

未解決のインテグレーション履歴記録を取得

方法

取得

API

https://<your instance hostname>/api/integration_history_records

クエリパラメーター

resolved=false
document-type=OrderHeader
document-id=<発注書ID
fields=["id","document-id","status","resolved"]

サンプルURL

https://<your instance hostname>/api/integration_history_records?resolved=false&document-type=OrderHeader&document-id=<Purchase Order id>&fields=["id","document-id","status","resolved"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration History Record id>,
				"document-id": <Purchase Order id>,
				"status": "Error",
				"resolved": false
		}
]

手順3b

以前のインテグレーション履歴記録を解決

方法

プット

API

https://<your instance hostname>/api/integration_history_records/<Old Integration History Record id>/resolve

クエリパラメーター

fields=["id","document-id","status","resolved"]

サンプルURL

https://<your instance hostname>/api/integration_history_records/<Old Integration History Record id>/resolve?fields=["id","document-id","status","resolved"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration History Record id>,
				"document-id": <Purchase Order id>,
				"status": "Error",
				"resolved": true
		}
]

手順4a

インテグレーション履歴を作成(成功)

方法

プット

API

https://<your instance hostname>/api/integration_history_records

クエリパラメーター

fields=["id","document-id","status"]

サンプルURL

https://<your instance hostname>/api/integration_history_records?fields=["id","document-id","status"]

クエリ本文のサンプル


{
		"document-type": "OrderHeader",
		"document-id": <Purchase Order id>,
		"document-status":"<Purchase Order status>",
		"contact-alert-type": "Functional",
		"status": "Success",
		"integration": {"code":"<Customer Integration id>"},
		"responses": [
				{
						"response-code": "Success-1234",
						"response-message": "The integration in the ERP went well"
				}
		]
}

返答本文のサンプル


{
		"id": <New Integration History Record id>,
		"document-id": <Purchase Order id>,
		"status": "Success"
}

手順4b

インテグレーション履歴(エラー)を作成し、インテグレーション連絡先にアラートを送信します

方法

プット

API

https://<your instance hostname>/api/integration_history_records/create_alert

クエリパラメーター

fields=["id","document-id","status"]

サンプルURL

https://<your instance hostname>/api/integration_history_records/create_alert?fields=["id","document-id","status"]

クエリ本文のサンプル


{
		"document-type": "OrderHeader",
		"document-id": <Purchase Order id>,
		"document-status":"<Purchase Order status>",
		"contact-alert-type": "Functional",
		"status": "Error",
		"integration": {"code":"<Customer Integration id>"},
		"responses": [
				{
						"response-code": "Failure-CC",
						"response-message": "Line 1: Cost center CA234 is closed for ordering"
				},
				{
						"response-code": "Failure-date",
						"response-message": "Line 2: Delivery date cannot be in the past"
				}
		]
}

返答本文のサンプル


{
		"id": <New Integration History Record id>,
		"document-id": <Purchase Order id>,
		"status": "Error"
}

オプション3:Coupaインテグレーションの完全監視を活用

説明

このシナリオでは、追跡するインテグレーション実行を作成します

  • インテグレーションのステータス(保留中/開始済み/エラー済み/成功/失敗)
  • 処理されたPOの合計数
  • 成功とエラーの数
  • インテグレーションエラーとそのステータスのリスト(解決済みかどうか)

POごとに次を行います。

  • ドキュメントの以前のインテグレーション履歴記録を解決します
  • インテグレーション履歴記録を作成
  • エラーが発生した場合は、インテグレーションエラーとインテグレーション連絡先へのアラートを作成します

インテグレーションのすべてのインテグレーション実行は、で監視できますhttps://<your instance hostname>/integrations/<your integration id>/integration_runs

po-api-integration-01.png

標準POインテグレーションエラーデータテーブルを使用して、インテグレーションエラーが解決を保留中のすべてのPOを一覧表示します。所在地は。https://<your instance hostname>/integration_errors
po-integration-errors.png

標準POインテグレーション履歴データテーブルを使用して、正常に統合されたすべてのPOを一覧表示します。 所在地はhttps://<your instance hostname>/integration_history_records/purchase_orders

po-integration-records.png
オーケストレーション図

orchestration-3.png

ステップ/ APIコールの詳細

手順1

インテグレーション実行を作成

方法

投稿

API

https://<your instance hostname>/api/integration_runs

クエリパラメーター

該当なし

クエリ本文のサンプル


{
		"integration": {
				"code": "{{integration_code}}"
		}}

返答本文のサンプル


{
		"id": <Integration Run ID>,
		...
}

手順2

ERPで作成/更新するCoupa発注書のリストと詳細を取得します。
選択基準には、[エクスポートフラ グ]と[POステータス ] が含まれます。
ERPでPOの更 新を処理するには、クエリパラメーターshow_deleted _linesが必要になる場合があります

方法

取得

API

https://<your instance hostname>/api/purchase_orders/

クエリパラメーター

filter=
offset=10
exported=false
show_deleted_lines=true
status[in]=buyer_hold,issued,cancelled,closed,soft_closed

サンプルURL

https://<your instance hostname>/api/purchase_orders?filter=<your API filter name>&offset=10&exported=false&show_deleted_lines=true&status[in]=buyer_hold,issued,canceled,closed,soft_closed

クエリ本文のサンプル

該当なし

返答本文のサンプル

step-3.png

手順3

インテグレーション実行の開始

方法

プット

API

https://<your instance hostname>/api/integration_runs/<Integration Run ID>/run

クエリパラメーター

該当なし

クエリ本文のサンプル


{
		"total_records": <Total Number of POs from Step 2>
}

返答本文のサンプル


{
		"id": <Integration Run ID>,
		...
}

手順4

個別のPOをエクスポート済みとしてマーク

方法

プット

API

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>

クエリパラメーター

exported=true
fields=["id","exported"]

サンプルURL

https://<your instance hostname>/api/purchase_orders/<Purchase Order id>?exported=true&fields=["id","exported"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


{
		"id": <Purchase Order id>,
		"exported": true
}

ここで、ERPでのPOの作成/更新が行われます。

手順5a

未解決のインテグレーション履歴記録を取得

方法

取得

API

https://<your instance hostname>/api/integration_history_records

クエリパラメーター

resolved=false
document-type=OrderHeader
document-id=<Purchase Order id>
fields=["id","document-id","status","resolved"]

サンプルURL

https://<your instance hostname>/api/integration_history_records?resolved=false&document-type=OrderHeader&document-id=<Purchase Order id>&fields=["id","document-id","status","resolved"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration History Record id>,
				"document-id": <Purchase Order id>,
				"status": "Error",
				"resolved": false
		}
]

手順5b

以前のインテグレーション履歴記録を解決

方法

プット

API

https://<your instance hostname>/api/integration_history_records/<Old Integration History Record id>/resolve

クエリパラメーター

fields=["id","document-id","status","resolved"]

サンプルURL

https://<your instance hostname>/api/integration_history_records/<Old Integration History Record id>/resolve?fields=["id","document-id","status","resolved"]

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration History Record id>,
				"document-id": <Purchase Order id>,
				"status": "Error",
				"resolved": true
		}
]

手順6a

未解決のインテグレーションエラーレコードを取得

方法

取得

API

https://<your instance hostname>/api/integration_errors

クエリパラメーター

resolved=false
document-type=OrderHeader
document-id=<Purchase Order id>

サンプルURL

https://<your instance hostname>/api/integration_errors?resolved=false&document-type=OrderHeader&document-id=<Purchase Order id>

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration Error Record id>,
				"document-type": ”OrderHeader”,
				"document-id": <Purchase Order id>,
				"status": "Error",
		"resolved": false
		...
		}
]

手順6b

以前のインテグレーション履歴記録を解決

方法

プット

API

https://<your instance hostname>/api/integration_errors/<Old Integration Error Record id>/resolve

クエリパラメーター

該当なし

クエリ本文のサンプル

該当なし

返答本文のサンプル


[
		{
				"id": <Old Integration Error Record id>,
				"document-id": <Purchase Order id>,
				"status": "Error",
				"resolved": true
				...
		}
]

手順7a

インテグレーション履歴を作成(成功)
インテグレーション実行を参照する必要があります

方法

プット

API

https://<your instance hostname>/api/integration_history_records

クエリパラメーター

fields=["id","document-id","status"]

サンプルURL

https://<your instance hostname>/api/integration_history_records?fields=["id","document-id","status"]

クエリ本文のサンプル


{
		"document-type": "OrderHeader",
		"document-id": <Purchase Order id>,
		"document-status":"<Purchase Order status>",
		"contact-alert-type": "Functional",
		"status": "Success",
		"integration": {"code":"<Customer Integration id>"},
		"integration-run": {"id":<Integration Run ID>},
		"responses": [
				{
						"response-code": "Success-1234",
						"response-message": "The integration in the ERP went well"
				}
		]}

返答本文のサンプル


{
		"id": <New Integration History Record id>,
		"document-id": <Purchase Order id>,
		"status": "Success"
}

手順7b

インテグレーションエラーを作成し、インテグレーション連絡先にアラート
インテグレーション実行を参照する必要があります

方法

プット

API

https://<your instance hostname>/api/integration_errors/create_alert

クエリパラメーター

該当なし

クエリ本文のサンプル


{
		"document-type": "OrderHeader",
		"document-id": <Purchase Order id>,
		"document-status":"<Purchase Order status>",
		"contact-alert-type": "Functional",
		"status": "Error",
		"integration-run-id": "<Integration Run ID>",
		"responses": [
				{
						"response-code": "Failure-CC",
						"response-message": "Line 1: Cost center CA234 is closed for ordering"
				},
				{
						"response-code": "Failure-date",
						"response-message": "Line 2: Delivery date cannot be in the past"
				}
		]
}

返答本文のサンプル


{
		"id": <New Integration Error Record id>,
		"document-id": <Purchase Order id>,
		"status": "Error"
		 ...
}

手順8

インテグレーション実行を正常に終了

方法

プット

API

https://<your instance hostname>/api/integration_runs/<Integration Run ID>/success

クエリパラメーター

該当なし

クエリ本文のサンプル

該当なし

返答本文のサンプル


{
		"id": <Integration Run ID>,
		"status": "successful"
		...
}

インテグレーション実行中に一般的な障害が発生した場合

手順x

インテグレーション実行の失敗を発生させる

方法

プット

API

https://<your instance hostname>/api/integration_runs/<Integration Run ID>/fail

クエリパラメーター

該当なし

クエリ本文のサンプル

該当なし

返答本文のサンプル


{
		"id": <Integration Run ID>,
		"status": "failed"
		...
}

 

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

関連アイテム


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エンドポイントを整理しました。