発注書の修正APIコールの例

概要

発注書の修正APIでは、発注書の変更履歴へアクセスできます。 このAPIには、変更により発注書がサプライヤーに再送信されるかどうか(新しい明細または明細の数量の変更など)、または変更が内部的であるかどうか(アカウントコードの変更など)、発注書への各変更のレコードが含まれています。

APIは発注書APIと構造が似ていますが、主に3つの違いがあります。

  1. レコードには「revision-record」要素があり、 これにはレコードにキャプチャされた特定の「内部修正」または発注の変更に関する情報が含まれています。
  2. いくつかの例外を除き、変更されたフィールドのみが表示されます。 変更に関係なく表示されるフィールドは、発注ID、発注明細ID、または追加または削除された場合に「true」と表示される<created/>と<deleted/>のフィールドのみです。
  3. それぞれの非発注書IDまたは発注明細IDフィールド要素には、2つの新しい要素である<from/>と<to/>が含まれます。 <to/>フィールドには、この修正で作成または更新された新しい値が含まれ、<from/>フィールドには前回の修正の値が含まれます。 これについては、以下の「フィールド定義」セクションで詳しく説明します。

発注書にアクセスするためのURLは次のとおりです。 https ://<instance>/api/purchase_order_revisions

検索条件

クエリパラメーターの「base」パスは、revision-record要素内にあります。 id=123を渡すと、PO 123の修正レコードではなく、ID 123の修正レコードが取得されます。 特定の発注書を検索するには、「purchase_order_id」の特別なパラメーターを使用し、値を希望する発注書番号として設定する必要があります。

参照オブジェクト検索条件オプション
発注書IDpurchase_order_id
内部修正番号revision
変更が行われた日付作成日時

フィールド定義

関連オブジェクトである<to/>および<from/>フィールドには、完全な関連オブジェクトが含まれます。

シンプルフィールドアップデート

<?xml version="1.0" encoding="UTF-8"?> <status> <from type="string">ドラフト</from> <to type="string">作成</to> </status>

関連フィールドの更新

<?xml version="1.0" encoding="UTF-8"?> <updated-by> <from> <id type="integer">37</id> <login>test_user@coupa.com</login> <email>test_user@coupa.com</email> <employee-number /> <firstname>Test</firstname> <lastname>User</lastname> <salesforce-id nil="true" /> <custom_field_on_the_user>ABC</custom_field_on_the_user> </from> <to> <id type="integer">24</id> <login>update_user@coupa.com</login> <email>update_user@coupa.com</email> <employee-number /> <firstname>Update</firstname> <lastname>User</lastname> <salesforce-id nil="true" /> <custom_field_on_the_user>DEF</custom_field_on_the_user> </to> </updated-by>

サンプルAPI GETレスポンス

<?xml version="1.0" encoding="UTF-8"?> <order-header-revision> <revision-record> <revision type="integer">1</revision> <id type="integer">30</id> <created-at type="datetime">2010-12-11T14:27:15-08:00</created-at> <created-by type="integer">1</created-by> </revision-record> <comments /> <test-text-field> <from type="string">test_receipts</from> <to type="string" /> </test-text-field> <id type="integer">2143</id> <order-lines> <order-line> <testfield> <from type="string" /> <to type="string" /> </testfield> <id type="integer">3060</id> <line-num type="integer">1</line-num> <need-by-date> <from type="datetime">2010-07-23T07:00:00-07:00</from> <to type="datetime">2010-07-23T00:00:00-07:00</to> </need-by-date> <source-part-num> <from type="string" /> <to type="string" /> </source-part-num> <updated-at> <from type="datetime">2010-12-10T20:40:45-08:00</from> <to type="datetime">2010-12-11T14:27:13-08:00</to> </updated-at> <updated-by> <from> <email>matt.support+supportAPI@coupa.com</email> <employee-number nil="true" /> <firstname>Matt</firstname> <id type="integer">44</id> <lastname>Support</lastname> <login>matt.support+supportAPI@coupa.com</login> </from> <to> <email>upgrade@coupa.com</email> <employee-number /> <firstname>Coupa</firstname> <id type="integer">1</id> <lastname>Support</lastname> <login>coupasupport</login> </to> </updated-by> </order-line> <order-line> <testfield> <from type="string" /> <to type="string" /> </testfield> <id type="integer">3061</id> <line-num type="integer">2</line-num> <need-by-date> <from type="datetime">2010-12-11T04:40:42-08:00</from> <to type="datetime">2010-12-11T00:00:00-08:00</to> </need-by-date> <source-part-num> <from type="string" /> <to type="string" /> </source-part-num> <updated-at> <from type="datetime">2010-12-10T20:40:45-08:00</from> <to type="datetime">2010-12-11T14:27:13-08:00</to> </updated-at> <updated-by> <from> <email>matt.support+supportAPI@coupa.com</email> <employee-number nil="true" /> <firstname>Matt</firstname> <id type="integer">44</id> <lastname>Support</lastname> <login>matt.support+supportAPI@coupa.com</login> </from> <to> <email>upgrade@coupa.com</email> <employee-number /> <firstname>Coupa</firstname> <id type="integer">1</id> <lastname>Support</lastname> <login>coupasupport</login> </to> </updated-by> </order-line> </order-lines> <ship-to-user> <from> <email>coupauser+2010-12-10T20:40:37-0800@coupa.com</email> <employee-number nil="true" /> <firstname>Test</firstname> <id type="integer">144</id> <lastname>Account</lastname> <login>query_user_2010-12-10T20:40:37-0800</login> </from> <to> <email>coupauser+2010-12-10T17:48:07-0800@coupa.com</email> <employee-number /> <firstname>Test</firstname> <id type="integer">45</id> <lastname>Account</lastname> <login>flow_user_2010-12-10T17:48:07-0800</login> </to> </ship-to-user> <updated-at> <from type="datetime">2010-12-10T20:40:46-08:00</from> <to type="datetime">2010-12-11T14:27:14-08:00</to> </updated-at> <updated-by> <from> <email>matt.support+supportAPI@coupa.com</email> <employee-number nil="true" /> <firstname>Matt</firstname> <id type="integer">44</id> <lastname>Support</lastname> <login>matt.Support+supportAPI@coupa.com</login> </from> <to> <email>upgrade@coupa.com</email> <employee-number /> <firstname>Coupa</firstname> <id type="integer">1</id> <lastname>Support</lastname> <login>coupasupport</login> </to> </updated-by> <version> <from type="integer">1</from> <to type="integer">2</to> </version> </order-header-revision>