ユーザーAPI

ユーザーAPIを使用して、ユーザーデータの作成、更新、照会を行います。

APIにアクセスするためのURL: https://<instance>.cso.coupahost.com/api/users

詳細については、統合のベストプラクティスを参照してください。

アクション

動詞

パス

アクション

説明

GET

/api/users

インデックス

GETアクションを実行し、すべてのユーザーを取得

POST

/api/users

作成

1人または複数のユーザーを作成。

PUT

/api/users

更新

1人または複数のユーザーを更新。 一括更新も可能です。

GET

/api/users /: id

表示

指定したユーザーのデータを表示。

PUT

/api/users /: id

更新

IDを使用して1人ずつユーザーを更新

Elements

ユーザーAPIで使用できる要素は次のとおりです。

フィールド名

フィールドの説明

必須

一意?

許容値

入力

アウト*

Type

ID

ユーザーのID

はい

yes&#10;

整数

state

ユーザーのステータス

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

yes&#10;

yes&#10;

文字列

名前

ユーザーのログイン名。 一度設定すると変更できません。

はい

yes&#10;

文字列

first-name

ユーザーの名

yes&#10;

last-name

ユーザーの姓

yes&#10;

phone-number

ユーザーの電話番号

yes&#10;

yes&#10;

文字列

mobile-number

ユーザーの携帯電話番号

yes&#10;

email

ユーザーのメールアドレス。 一度設定すると変更できません。

yes&#10;

文字列

company-id

ユーザーに割り当てられた会社ID。 一度設定すると変更できません。

street

ユーザー住所の番地情報

yes&#10;

yes&#10;

文字列

zip-code

ユーザー住所の郵便番号

yes&#10;

yes&#10;

文字列

ユーザー住所の市区町村

yes&#10;

yes&#10;

文字列

ユーザー住所の国

yes&#10;

yes&#10;

文字列

keywords

ユーザーに関連付けられたキーワード

yes&#10;

yes&#10;

文字列

external-user-name

ユーザーに割り当てられた外部ユーザー名。

yes&#10;

accepts-agreement

ユーザーが同意書を承諾したかどうかを示します。

yes&#10;

yes&#10;

provide-information

次回ログイン時にユーザー情報の入力を求めるかどうかを示します。

yes&#10;

yes&#10;

change-password

次回ログイン時にパスワードの変更を求めるかどうかを示します。

yes&#10;

invoicing_user

請求ユーザー

any

yes&#10;

boolean

注:

レスポンスのペイロードにはnull値は含まれません。

この例では、ユーザーAPIに対してクエリを実行しました。 以下のURLに対してGETリクエストを実行しました。

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

ユーザーGETレスポンス

{" total ": 3, "users ": [{" id ":" 9219595862193003588 ", "state ":" Active ", "name ":" dekke 434 ", "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 ":" 2935 AR ", "city ":" Ouderkerk aan den IJssel ", "country ":" Netherlands ", "accepts - entry ": false," provide - information ": false, "change - password ": false}," mobile - name ": "9219595145795283441 "," state ": "Active "," name ": "deeed "," first - name ": "Arjan," last - name ": "Deeed "," phone - number ": "+313132323 ", "email ":" mht "@nest ", "company - id ": "," 921959 "name "," first - name ": ", "name ":" Deeed ", "phone ":" mhl ", "9219313313 "," mhest ", "company - id ":" 9219212 ", "country ":" accept - name ": ", "true - name ":" true ": ", "provide - name ":" true ": "true "," true "、": "true - name ": "、" true "、"、"true ": "、" true - pass "、"、": "、"true - name ": "、"、" true ": "true "、"、"、"、"、" name "、"、"、"true - code ": ": "、"、"、"、"、"、"、" true - name "、"、"、"、"、"true - name "、"、" dr "、"、"、"、"true - code "、"、"、"、"true "、"、"、" true "、"、"、"、"、"dr "、"、" d "、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、" true - code "、"、"、"、" true - code "、"、"、"、"、"、"、"、" d "、"、"、"、"、"、"、"、"、"、"、"、"、"、"、" true "、"、"、"、"、"、"、"、"、"、"、"、" true "、"、" true "、"、" d "、"、"true、"、"、" true、"、"、"true、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"true、"、"、" true、"、"、"true、"、"、"、"、"、"、"、"、"true、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、"、

作成/更新

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

Create

/api/users

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

ペイロード: {" users ": [{" state ": "Active "," name ": "tester 123456 "," first - name ": "tester "," last - name ": "user 1 "," 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 - entry ": false, "provide - information ": true," change - password ": false}, {" name ": "tester 12345 "," first - name ": "testing "," last - name ": "user "," phone - number ": ": "+1 (111 )-234 -5678 ", "mobile - number ": "+1 (11 )-123 -3456 "," email ": "tester@tester.com "," company - id ": "92205383250662 "," street ": "12345 bethoven" road ", "zip - code" 30811 ", "rot" dam ": false, "provide - information ": true," change - password ": false}, {" name ": "tester 12345 ", ":" first - name ": "testing "," last - name ": "user "," phone - number ": ": ": "+1 (111 )-234 -5678 "," mobile - number ": ": ": "+1 (11 )-123 -3456 "," email ": ": "tester@tester@tester "," company - id ", "company - id ":" 92205353250662 ", "street "," street ": "street ":" street ": ": "12345 ":" bethoven ", "zip - code" zip - code ": "city ": ": ":" city ": "city ": ": "," city "c ":" c "city" city ": ": "c" c ": ", "c" c "c" city "c ":" c "c" c ": "c" c ": ": ": "c "," c "c" c "c" c "c "," c "c" c "c" c "c" c "c" c "c" c "c" c ": "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "c" c "t" c "c" t "t" c "c" t "t" t "t" c "c" t "t" t ", "t" t "t" t "t" t ", ", "t" t "t" t "t "," t "t" t "t" t "t "," t "t" t ": ": "t ":" t ", "t" t ": ": "t" t ", "t" t "t }]," added ": 2 ," users ":[{" id ":" 9220538753483272432 "},{" id ":" 9220538753482068122 "}]}

Update

/api/users

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

一度に1人以上のユーザーを更新するには:ペイロード:{" 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}]}応答: 200 OK {" result ":[{" type ":" api.put.updated "," description ":" 2 objects updated ." }], "updated": 2}
注:

更新は寛容に処理されます。つまり、1つのリソースの更新に失敗しても、他のリソースは成功する場合があります。 更新にはユーザーIDが必須です。

成功した要求は HTTP 200応答を返します。 レスポンスの本文には作成された申請書が含まれます。 リクエストが失敗すると、次が返されます:

HTTP 400不正な要求

. レスポンスの本文にはXML形式の検証エラーが含まれます。