サプライヤーAPIコール例

GETサプライヤーのクエリオプション

以下は、サプライヤーAPIを使用して、希望する結果セットを取得するための使用例です。

このクエリは、発注方法がcXMLに設定されているすべてのサプライヤーを返します。
https ://<instance url>/api/suppliers? po - method = cxml

このクエリは、支払条件が「Net 30」に設定されているすべてのサプライヤーを返します。

https ://<instance url>/api/suppliers? payment - term [code] = Net +30
このクエリは、請求書発行から10日以内の支払で割引が適用され、システム上でアクティブなサプライヤーを返します。
https ://<instance url>/api/suppliers? payment - term [days - for - discount - payment] = 10 & status = active
このクエリは、2010年1月1日12:00:00以降に作成されたすべてのサプライヤーを返します。
https ://<instance url>/api/suppliers? created - at [gt] = 2010 -01 -01 T 12:00:00
このクエリは、発注方法がcXMLに設定されており、バイヤードメイン値に「domain」という単語が含まれているすべてのサプライヤーを返します。
https ://<instance url>/api/suppliers? po - method = cxml&cxml - domain [contains] = domain

このクエリは、cXML請求が許可されており、サプライヤードメイン値のcXML請求書設定に「サプライヤー」という単語が含まれているすべてのサプライヤーを返します。 https ://<instance>.coupahost.com/api/suppliers?allow-cxml-invoicing=true&cxml-supplier-domain [contains] = supplier

このクエリは、代表連絡先メールアドレスに「coupa.com」が含まれ、市区町村がCharlestonのサプライヤーを返します。
https ://<instance url>/api/suppliers? primary - contact [email] [contains] = coupa.com&primary - address [city] =チャールストン
このクエリは、システム内で5件以上のユーザーレビューがあるすべてのサプライヤーを返します。
https ://<instance url>/api/suppliers? reviews - count [gt] = 5

サプライヤーを取得

この例では、IDが6の単一のサプライヤーレコードをクエリしています。

以下のURLに対してGETリクエストを実行しました。

https ://<instance url>/api/suppliers/6

または

https ://<instance url>/api/suppliers? id = 6

以下は、検索条件に一致したレスポンスの例です。
<?xml version="1.0" encoding="UTF-8"?> <suppliers type="array"> <supplier> <id type="integer">6</id> <created-at type="datetime">2008-10-27T12:56:39-07:00</created-at> <updated-at type="datetime">2009-07-01T11:59:33-07:00</updated-at> <name>VWR</name> <number></number> <status>active</status> <website></website> <po-method>cxml</po-method> <cxml-url>http://www.dummy.com</cxml-url> <cxml-domain>http://demo.coupahost.com</cxml-domain> <cxml-identity>Coupa</cxml-identity> <cxml-supplier-domain>http://www.vwr.com</cxml-supplier-domain> <cxml-supplier-identity>VWR-Test</cxml-supplier-identity> <cxml-secret>test</cxml-secret> <cxml-protocol>cXML</cxml-protocol> <po-email>upgrade@coupa.com</po-email> <account-number></account-number> <duns></duns> <tax-id></tax-id> <coupa-connect-secret></coupa-connect-secret> <invoice-matching-level>2-ay</invoice-matching-level> <primary-contact> <email>upgrade@coupa.com</email> <id type="integer">6</id> <name-additional nil="true"></name-additional> <name-family>Frontage</name-family> <name-fullname nil="true"></name-fullname> <name-given>Dawn</name-given> <name-prefix nil="true"></name-prefix> <name-suffix nil="true"></name-suffix> <notes nil="true"></notes> </primary-contact> <primary-address> <attention nil="true"></attention> <city>Portland</city> <id type="integer">6</id> <name>VWR</name> <postal-code>82323</postal-code> <state>OR</state> <street1>09 Addison Ave</street1> <street2></street2> <country> <code>US</code> <id type="integer">223</id> <name>United States</name> </country> </primary-address> <payment-term> <code>2/10 Net 30</code> <days-for-discount-payment type="integer">10</days-for-discount-payment> <days-for-net-payment type="integer">30</days-for-net-payment> <discount-rate type="float">2.0</discount-rate> <id type="integer">3</id> </payment-term> </supplier> </suppliers>

サプライヤーの作成 – アクティブおよび詳細設定

この例では、アクティブなサプライヤーを新規作成しています。 参照オブジェクトにはCoupaのシステムIDは使用していません。

以下のURLに対してPOSTリクエストを送信しました。
https ://<instance url>/api/suppliers.
<?xml version="1.0" encoding="UTF-8"?> <supplier> <name>CDW</name> <number>cdw 2323</number> <status>active</status> <po-method>prompt</po-method> <po-email /> <account-number>2323</account-number> <duns /> <tax-id>283923</tax-id> <invoice-matching-level>3 - way</invoice-matching-level> <payment-term> <code>Net 30</code> </payment-term> <primary-contact> <email>joe.smith@cdw.com</email> <name-family>Smith</name-family> <name-given>Joe</name-given> <name-prefix nil="true" /> <name-suffix nil="true" /> <notes nil="true" /> <phone-work> <area-code>650</area-code> <country-code>1</country-code> <extension nil="true" /> <number>4442932</number> </phone-work> <phone-mobile> <area-code nil="true" /> <country-code>1</country-code> <extension nil="true" /> <number /> </phone-mobile> <phone-fax> <area-code nil="true" /> <country-code>1</country-code> <extension nil="true" /> <number /> </phone-fax> </primary-contact> <primary_address> <street1>1234 Concur Drive</street1> <street2 /> <city>San Mateo</city> <state>CA</state> <postal_code>93325</postal_code> <country> <code>US</code> </country> </primary_address> </supplier>

サプライヤーの作成 - 下書きおよび基本情報

この例では、下書き状態のサプライヤーを新規作成しています。 参照オブジェクトにはCoupaのシステムIDは使用していません。

以下のURLに対してPOSTリクエストを送信しました。
https ://<instance url>/api/suppliers. これにより、サプライヤーがドラフトステータスになりました。
<?xml version="1.0" encoding="UTF-8"?> <supplier> <name>CDW</name> <po-method>prompt</po-method> <account-number>2323</account-number> <duns /> <tax-id /> <invoice-matching-level>3 - way</invoice-matching-level> <payment-term> <code>Net 30</code> </payment-term> </supplier>

サプライヤーの更新 - 完全な更新

この例では、サプライヤーレコード上のさまざまな情報を更新する方法を示しています。

以下のURLに対してPUTリクエストを実行しました。
https ://<instance url>/api/suppliers/<supplier id>

たとえば、サプライヤーIDが「83」のサプライヤーの発注方法をcXMLに更新するには、以下を使用します。

URL
https ://<instance url>/api/suppliers/83
<?xml version="1.0" encoding="UTF-8"?> <supplier> <po-method>cxml</po-method> <cxml-url>https://testurl.com</cxml-url> <cxml-domain>NetworkID</cxml-domain> <cxml-identity>coupa</cxml-identity> <cxml-supplier-domain>NetworkID</cxml-supplier-domain> <cxml-supplier-identity>supplierID 1</cxml-supplier-identity> <cxml-secret>shhhh</cxml-secret> <cxml-protocol>cxml</cxml-protocol> </supplier>

たとえば、サプライヤーIDが「83」のサプライヤーに対して、代表連絡先情報やその他複数のサプライヤープロフィール情報を更新するには、以下を使用します。

URL
https ://<instance url>/api/suppliers/83
<?xml version="1.0" encoding="UTF-8"?> <supplier> <account-number>123456</account-number> <duns>DUNS -123</duns> <tax-id>taxid -123</tax-id> <invoice-matching-level>none</invoice-matching-level> <primary-contact> <email>supplier@test.com</email> <name-family>Donovan</name-family> <name-given>Fred</name-given> <phone-work> <area-code>415</area-code> <country-code>1</country-code> <extension nil="true" /> <number>4471010</number> </phone-work> <phone-fax> <area-code>415</area-code> <country-code>1</country-code> <extension nil="true" /> <number>4471012</number> </phone-fax> </primary-contact> </supplier>

たとえば、サプライヤーIDが「83」のサプライヤープロフィール(住所の更新を含む)を更新するには、以下を使用します。

URL
https ://<instance url>/api/suppliers/83
<?xml version="1.0" encoding="UTF-8"?> <supplier> <name>Petra (US)</name> <number>1 -112</number> <primary-address> <street1>425 Market Street # 2250</street1> <street2 /> <city>San Francisco</city> <state>CA</state> <postal_code>94105</postal_code> <country> <code>US</code> </country> </primary-address> </supplier>

たとえば、サプライヤーIDが「83」の支払条件と発送条件を更新するには、以下を使用します。

URL
https ://<instance url>/api/suppliers/83
<supplier> <shipping-term> <id>1</id> </shipping-term> <payment-term> <id>5<id> </payment-term> </supplier>

サプライヤーの更新 - 簡単な更新

この例では、サプライヤーレコード上の単一の属性を更新する方法を示しています。

以下のURLに対してPUTリクエストを実行しました。
https ://<instance url>/api/suppliers/<supplier id>

たとえば、サプライヤーIDが「83」のサプライヤーのステータスを非アクティブに更新する場合、以下を使用します。

サプライヤーを更新-無効に設定

URL
https ://<instance url>/api/suppliers/83
<?xml version="1.0" encoding="UTF-8"?> <supplier> <status>非アクティブ</status> </supplier>

たとえば、サプライヤーIDが「83」のサプライヤーの発注方法をプロンプトに更新するには、以下を使用します。

サプライヤーの更新-発注方法の変更

URL: https ://<instance url>/api/suppliers/83

<?xml version="1.0" encoding="UTF-8"?> <supplier> <po-method>プロンプト</po-method> </supplier>

たとえば、サプライヤーIDが「83」のサプライヤー代表連絡先のメールアドレスを更新するには、以下を使用します。

サプライヤーを更新-連絡先メールアドレスを変更

URL
https ://<instance url>/api/suppliers/83
<?xml version="1.0" encoding="UTF-8"?> <supplier> <primary-contact> <email>test@test.com</email> </primary-contact> </supplier>