• 最終編集日時: 25 March 2021

ユーザーAPI

ユーザーAPIを使用して、ユーザーデータを作成、更新、またはクエリします。

ユーザーAPIを使用して、ユーザーデータを作成、更新、またはクエリします。 

APIにアクセスするためのURLは次のとおりです。 https://<instance>.cso.coupahost.com/api/users

詳細については、 「インテグレーションのベストプラクティス 」を参照してください。

アクション

動詞 パス アクション 説明
取得 /api/users インデックス すべてのユーザーを取得するGetアクションを実行します
投稿 /api/users 作成 1人以上のユーザーを作成します。
プット /api/users 更新 1人以上のユーザーを更新します。一括更新を実行できます。
取得 /api/users/:id 表示 ユーザーデータを表示します。 
プット /api/users/:id 更新 IDを使用して一度に1人のユーザーを更新する

要素

これらはユーザーAPIで使用できる要素です

フィールド名 フィールドの説明 必須 一意ですか? 許容値 アウト* タイプ
ID

ユーザーのID

  はい     はい 整数
state ユーザーのステータス    

ブロック済み、アクティブ、無効、削除済み(大文字と小文字を区別)

はい はい string型
名前 ユーザーのログイン名。一度設定すると変更できません。   はい     はい 文字列
ユーザーの名       はい    
ユーザーの姓       はい    
電話番号 ユーザーの電話番号       はい はい 文字列
携帯電話番号 ユーザーの携帯電話番号       はい    
メール ユーザーのメールアドレス。一度設定すると変更できません。         はい 文字列
会社ID ユーザーの会社ID。一度設定すると変更できません            
番地 ユーザー住所の番地       はい はい 文字列
郵便番号 ユーザー住所の郵便番号の部分       はい はい 文字列
city ユーザー住所の市区町村       はい はい string型
ユーザー住所の国部分       はい はい 文字列
キーワード ユーザーに関連付けられたキーワード       はい はい 文字列
外部ユーザー名 ユーザーに割り当てられた外部ユーザー名。         はい  
同意を承認 ユーザーが必要な契約を承諾したかどうかを示します。       はい はい  
提供情報 ユーザーが次のログイン時にユーザー情報を提供する必要があるかどうかを示します。       はい はい  
パスワード変更 ユーザーが次のログイン時にパスワードを変更する必要があるかどうかを示します。       はい    
メモ

 応答ペイロードにnull値が表示されません。

この例では、ユーザーAPIについてクエリを実行しました。URLにGETしました: 

https://<instance>.cso.coupahost.com/api/users 

ユーザーGET応答

{
		"total": 3,
		"users": [
				{
						"id": "9219595862193003588",
						"state": "Active",
						"name": "dekke434",
						"first-name": "Arjan",
						"last-name": "Goud",
						"phone-number": "+310987898789",
						"mobile-number": "+31(0) 6 98876554",
						"email": "a.goud@deeder.com",
						"company-id": "9219592232917474305",
						"street": "IJsseldijk west 66",
						"zip-code": "2935AR",
						"city": "Ouderkerk aan den IJssel",
						"country": "Netherlands",
						"accepts-agreement": false,
						"provide-information": false,
						"change-password": false
				},
				{
						"id": "9219595145795283441",
						"state": "Active",
						"name": "deeed",
						"first-name": "Arjan",
						"last-name": "Deeed",
						"phone-number": "+313132323133",
						"email": "mh@test.nl",
						"company-id": "9219592331212583950",
						"country": "Netherlands",
						"accepts-agreement": false,
						"provide-information": true,
						"change-password": true
				},
				{
						"id": "9219592232917474526",
						"state": "Active",
						"name": "eurot494",
						"first-name": "Marjus",
						"last-name": "van Dee",
						"phone-number": "+31121212121",
						"mobile-number": "+31313131333",
						"email": "test@test.com",
						"company-id": "9219592232917474528",
						"street": "Brielselaan 69, Haven 1357",
						"zip-code": "3081AA",
						"city": "Rotterdam",
						"country": "Netherlands",
						"accepts-agreement": false,
						"provide-information": true,
						"change-password": false
				}
	 ]
}

作成/更新

以下では、Coupa APIを使用してユーザーに対してアクションを実行する方法について説明します。

作成

/api/users

以下のペイロードは2つのユーザーを作成します。

Payload: 
{
		"users": [
				{
						"state": "Active",
						"name": "tester123456",
						"first-name": "tester",
						"last-name": "user1",
						"phone-number": "+1(111)-234-5678",
						"mobile-number": "+1(11)-123-3456",
						"email": "testeruser@tester.com",
						"company-id": "9220538753250662192",
						"street": "12345 bethoven road",
						"zip-code": "30811",
						"city": "Rotterdam",
						"country": "United States",
						"accepts-agreement": false,
						"provide-information": true,
						"change-password": false
				},
				 {
						"name": "tester12345",
						"first-name": "testing",
						"last-name": "user",
						"phone-number": "+1(111)-234-5678",
						"mobile-number": "+1(11)-123-3456",
						"email": "tester@tester.com",
						"company-id": "9220538753250662192",
						"street": "12345 bethoven road",
						"zip-code": "30811",
						"city": "Rotterdam",
						"country": "United States",
						"accepts-agreement": true,
						"provide-information": true,
						"change-password": false
				}
		]
}
Response: 201
{
		"result": [
				{
						"type": "api.post.added",
						"description": "2 objects created."
				}
		],
		"added": 2,
		"users": [
				{
						"id": "9220538753483272432"
				},
				{
						"id": "9220538753482068122"
				}
		]
}	 

更新

/api/users

以下のペイロードはユーザーを更新します。 

To update one or more User at a time: 
Payload:
{
		"users": [
				{
						"id": "9220538753483272432",
						"state": "Blocked",
						"email": "testeruser-upd@tester.com",
						"accepts-agreement": true,
						"provide-information": true,
						"change-password": false
				},
				{
						"id": "9220538753482068122",
						"state": "Blocked",
						"email": "tester-upd@tester.com",
						"accepts-agreement": false,
						"provide-information": true,
						"change-password": false
				}
		]
}

Response: 200 OK
{
		"result": [
				{
						"type": "api.put.updated",
						"description": "2 objects updated."
				}
		],
		"updated": 2
}
メモ

 更新は寛大な方法で行われます。たとえば、1つのリソースの更新に失敗した場合、他のリソースは正常に更新される可能性があります。更新にはユーザーIDが必要です。

成功したリクエストは返り HTTP 200 Responseます。回答の本文には、作成された申請書が含まれます。失敗したリクエストは返 HTTP 400 Bad Requestされる。応答の本文には、XMLとしてフォーマットされた検証エラーが含まれます。

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

関連アイテム


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