サプライヤーAPIコールの例

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

サプライヤーAPIを使用して、必要な結果セットをクエリして取得する方法の例を以下に示します。

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

このクエリは、支払条件が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-01T12:00:00
 
このクエリは、発注方法がcXMLに設定されていて、購入者のドメイン値に「ドメイン」という言葉が含まれているすべてのサプライヤーを返します。 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」という値が含まれているすべてのサプライヤーと、チャールストン市のサプライヤー住所を返します。 https://<instance url>/api/suppliers?primary-contact[email][contains]=coupa.com&primary-address[city]=Charleston
 
このクエリは、システム内で少なくとも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に投稿しました: https://<instance url>/api/suppliers.

<?xml version="1.0" encoding="UTF-8"?>
<supplier>
	 <name>CDW</name>
	 <number>cdw2323</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に投稿しました: https://<instance url>/api/suppliers.  This created the supplier in a draft status.

<?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>supplierID1</cxml-supplier-identity>
	 <cxml-secret>shhhhh</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>inactive</status>
</supplier>

たとえば、サプライヤーIDが83のプロンプトを表示するようにサプライヤーの発注方法を更新するには、次の操作を行います。

サプライヤーの更新 – PO方法を変更

URL:https:///api/suppliers/83

<?xml version="1.0" encoding="UTF-8"?>
<supplier>
	 <po-method>prompt</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>

 

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

関連アイテム


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