• 最終編集日時: 12 August 2019

請求書APIのコール例

請求書の異なるクエリオプション

請求書APIを使用して必要な結果セットをクエリして取得する方法の例を以下に示します。 

このクエリは、CDWをサプライヤーとするすべての請求書を返します。 

https://<instance>.coupahost.com/api/invoices?supplier[name]=CDW
 
このクエリは、通貨としてユーロを含むすべての請求書を返します。 

https://<instance>.coupahost.com/api/invoices?currency[code]=EUR
 
このクエリは、2010年1月1日12:00:00以降に作成されたすべての請求書を返します。 

https://<instance>.coupahost.com/api/invoices?invoice-date[gt]=2010-01-01T12:00:00
 

単一の請求書を取得

この例では、IDが1の請求書レコードを1件検索しました。

URLにGETしました:

https://<instance>.coupahost.com/api/invoices/1
または

https://<instance>.coupahost.com/api/invoices?id=1

<?xml version="1.0" encoding="UTF-8"?>
<invoice-header>
	 <comments />
	 <created-at type="datetime">2008-10-28T11:19:49-07:00</created-at>
	 <handling-amount type="decimal">0.0</handling-amount>
	 <id type="integer">1</id>
	 <internal-note />
	 <invoice-date type="datetime">2008-10-28T00:00:00-07:00</invoice-date>
	 <invoice-number type="integer">500</invoice-number>
	 <line-level-taxation type="boolean">false</line-level-taxation>
	 <misc-amount type="decimal">0.0</misc-amount>
	 <shipping-amount type="decimal">0.0</shipping-amount>
	 <status>approved</status>
	 <supplier-note />
	 <tax-amount type="decimal">35.14</tax-amount>
	 <tax-rate type="float">8.25</tax-rate>
	 <updated-at type="datetime">2008-10-28T11:24:44-07:00</updated-at>
	 <paid type="boolean">false</paid>
	 <payment-date type="datetime" />
	 <payment-notes />
	 <exported type="boolean">false</exported>
	 <invoice-description type="string" />
	 <account-type>
			<id type="integer">1</id>
			<name>Ace Corporate</name>
	 </account-type>
	 <created-by>
			<email>upgrade+am@coupa.com</email>
			<employee-number />
			<firstname>Anna (AP Director)</firstname>
			<id type="integer">10</id>
			<lastname>Manning</lastname>
			<login>amanning</login>
	 </created-by>
	 <currency>
			<code>USD</code>
			<id type="integer">1</id>
	 </currency>
	 <supplier>
			<id type="integer">17</id>
			<name>Insight</name>
			<number nil="true" />
			<primary-contact>
				 <email>upgrade@coupa.com</email>
				 <id type="integer">18</id>
				 <name-additional nil="true" />
				 <name-family>Henderson</name-family>
				 <name-fullname nil="true" />
				 <name-given>Steve</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>5856306</number>
				 </phone-work>
				 <phone-mobile>
						<area-code>650</area-code>
						<country-code>1</country-code>
						<extension nil="true" />
						<number>5856306</number>
				 </phone-mobile>
				 <phone-fax>
						<area-code>650</area-code>
						<country-code>1</country-code>
						<extension nil="true" />
						<number>5856306</number>
				 </phone-fax>
			</primary-contact>
			<primary-address>
				 <attention nil="true" />
				 <city>Tempe</city>
				 <id type="integer">24</id>
				 <name>Insight</name>
				 <postal-code>85283</postal-code>
				 <state>AZ</state>
				 <street1>6820 South Harl Avenue</street1>
				 <street2 />
				 <country>
						<code>US</code>
						<id type="integer">223</id>
						<name>United States</name>
				 </country>
			</primary-address>
	 </supplier>
	 <tax-code>
			<code>CA</code>
			<id type="integer">1</id>
	 </tax-code>
	 <updated-by>
			<email>upgrade+cj@coupa.com</email>
			<employee-number />
			<firstname>Carl (Central Receiving)</firstname>
			<id type="integer">11</id>
			<lastname>Johnson</lastname>
			<login>cjohnson</login>
	 </updated-by>
	 <attachments />
	 <invoice-lines>
			<invoice-line>
				 <accounting-total type="decimal">425.99</accounting-total>
				 <created-at type="datetime">2008-10-28T11:19:49-07:00</created-at>
				 <description>Adobe Acrobat Professional -( v. 9 ) -complete package</description>
				 <id type="integer">1</id>
				 <line-num type="integer">1</line-num>
				 <order-header-num type="integer">7</order-header-num>
				 <order-line-id type="integer">10</order-line-id>
				 <order-line-num type="integer">1</order-line-num>
				 <price type="decimal">425.99</price>
				 <quantity type="float">1.0</quantity>
				 <status>matched</status>
				 <tax-rate type="float" />
				 <tax-location />
				 <tax-amount type="decimal">0.00</tax-amount>
				 <tax-description />
				 <tax-supply-date type="datetime" />
				 <total type="decimal">425.99</total>
				 <type>InvoiceQuantityLine</type>
				 <updated-at type="datetime">2008-10-28T11:24:44-07:00</updated-at>
				 <treasury-codes type="string" />
				 <account>
						<active type="boolean">true</active>
						<code>SF-IT-Assets</code>
						<id type="integer">18</id>
						<name>San Francisco -IT, Assets</name>
						<segment-1>SF</segment-1>
						<segment-10 />
						<segment-11 />
						<segment-12 />
						<segment-13 />
						<segment-14 />
						<segment-15 />
						<segment-16 />
						<segment-17 />
						<segment-18 />
						<segment-19 />
						<segment-2>IT</segment-2>
						<segment-20 />
						<segment-3>Assets</segment-3>
						<segment-4 />
						<segment-5 />
						<segment-6 />
						<segment-7 />
						<segment-8 />
						<segment-9 />
						<account-type>
							 <id type="integer">1</id>
							 <name>Ace Corporate</name>
						</account-type>
				 </account>
				 <accounting-total-currency>
						<code>USD</code>
						<id type="integer">1</id>
				 </accounting-total-currency>
				 <created-by>
						<email>upgrade+am@coupa.com</email>
						<employee-number />
						<firstname>Anna (AP Director)</firstname>
						<id type="integer">10</id>
						<lastname>Manning</lastname>
						<login>amanning</login>
				 </created-by>
				 <currency>
						<code>USD</code>
						<id type="integer">1</id>
				 </currency>
				 <item>
						<id type="integer">23</id>
						<created-at type="datetime">2008-10-28T10:12:02-07:00</created-at>
						<description>Adobe Acrobat 9 Professional software enables business professionals	to reliably create, combine, and control Adobe PDF documents for easy, more secure distribution, collaboration, and data collection.</description>
						<item-number>3235</item-number>
						<name>Adobe Acrobat Professional -( v. 9 ) -complete package</name>
						<updated-at type="datetime">2009-05-04T17:19:51-07:00</updated-at>
						<commodity>
							 <active type="boolean">true</active>
							 <created-at type="datetime">2008-10-28T17:13:45Z</created-at>
							 <id type="integer">8</id>
							 <name>Software</name>
							 <updated-at type="datetime">2009-08-14T16:34:54Z</updated-at>
							 <created-by>
									<email>upgrade@coupa.com</email>
									<employee-number nil="true" />
									<firstname>Coupa</firstname>
									<id type="integer">1</id>
									<lastname>Support</lastname>
									<login>coupasupport</login>
							 </created-by>
							 <updated-by>
									<email>upgrade+ke@coupa.com</email>
									<employee-number />
									<firstname>Kyle</firstname>
									<id type="integer">16</id>
									<lastname>Eisner</lastname>
									<login>administrator</login>
							 </updated-by>
						</commodity>
						<support-user>
							 <email>upgrade@coupa.com</email>
							 <employee-number nil="true" />
							 <firstname>Coupa</firstname>
							 <id type="integer">1</id>
							 <lastname>Support</lastname>
							 <login>coupasupport</login>
						</support-user>
						<uom>
							 <code>EA</code>
							 <id type="integer">1</id>
						</uom>
						<support-user>
							 <email>upgrade@coupa.com</email>
							 <employee-number nil="true" />
							 <firstname>Coupa</firstname>
							 <id type="integer">1</id>
							 <lastname>Support</lastname>
							 <login>coupasupport</login>
						</support-user>
						<reorder-alerts />
				 </item>
				 <uom>
						<code>EA</code>
						<id type="integer">1</id>
				 </uom>
				 <updated-by>
						<email>upgrade+cj@coupa.com</email>
						<employee-number />
						<firstname>Carl (Central Receiving)</firstname>
						<id type="integer">11</id>
						<lastname>Johnson</lastname>
						<login>cjohnson</login>
				 </updated-by>
			</invoice-line>
	 </invoice-lines>
</invoice-header>

請求書のプットの例

この例では、請求書レコードの単一の属性を更新します。

このフィールドは請求書のカスタムフィールドである必要があります。

URLにPUTを行いました: https://<instance>.coupahost.com/api/invoices/<invoice id> 

URL:  https://<instance>.coupahost.com/api/invoices/33

<?xml version="1.0" encoding="UTF-8"?>
<invoice-header>
	 <invoice_description>Invoice Test Description</invoice_description>
</invoice-header>

次の例は、請求品目を追加するためのputコールを示しています。

<?xml version="1.0" encoding="UTF-8"?>
<invoice-header>
	 <invoice-number>320</invoice-number>
	 <status>draft</status>
	 <invoice-lines type="array">
			<invoice-line>
				 <accounting-total type="decimal">499.00</accounting-total>
				 <description>iPad with Wi-Fi is ideal if you have a wireless high- speed Internet router in your home</description>
				 <price type="decimal">499.00</price>
				 <price-per-uom type="decimal">0.00</price-per-uom>
				 <quantity type="decimal">1.0</quantity>
				 <status>new</status>
				 <tax-amount type="decimal">0.00</tax-amount>
				 <total type="decimal">499.00</total>
				 <type>InvoiceQuantityLine</type>
				 <account>
						<name>HQ - IT, Assets</name>
						<code>HQ-IT-Assets</code>
						<active type="boolean">true</active>
						<segment-1>HQ</segment-1>
						<segment-2>IT</segment-2>
						<segment-3>Assets</segment-3>
						<account-type>
							 <name>Ace Corporate</name>
						</account-type>
				 </account>
				 <account-allocations type="array" />
				 <accounting-total-currency>
						<id type="integer">1</id>
						<code>USD</code>
				 </accounting-total-currency>
				 <currency>
						<id type="integer">1</id>
						<code>USD</code>
				 </currency>
				 <tax-lines type="array" />
			</invoice-line>
	 </invoice-lines>
</invoice-header>

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

関連アイテム


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