如何在Coupa API中获取特定经理/审批人下的用户列表?

时间:2017-04-03 10:25:16

标签: api coupa

我迷失了,我希望有人可能曾经为此做过工作。 所以Coupa有它的API: https://coupadocs.atlassian.net/wiki/display/integrate/Users+API

我能够与相应的经理一起检索用户信息。样品回复:

https://unknownserver-test.coupahost.com/api/users?employee-number=10003323

[
  {
    "id": 2756,
    "created-at": "2017-03-30T09:29:19-05:00",
    "updated-at": "2017-03-31T04:30:53-05:00",
    "login": "user1.user1",
    "email": "staging23@coupa.com",
    "purchasing-user": false,
    "expense-user": false,
    "sourcing-user": false,
    "inventory-user": false,
    "employee-number": "10003323",
    "phone-work": null,
    "phone-mobile": null,
    "firstname": "user1",
    "lastname": "user1",
    "fullname": "user1 user1",
    "api-user": false,
    "active": false,
    "salesforce-id": null,
    "account-security-type": 0,
    "authentication-method": "coupa_credentials",
    "sso-identifier": null,
    "default-locale": null,
    "default-account": null,
    "business-group-security-type": null,
    "edit-invoice-on-quick-entry": false,
    "avatar-thumb-url": null,
    "mention-name": "user1user1",
    "company-employee-id": "10003323",
    "netsuite-employee-id": "10003323",
    "subsidiary": {
      "id": 1592,
      "external-ref-num": null,
      "external-ref-code": "company North America:1"
    },
    "job-title": {
      "id": 2591,
      "external-ref-num": null,
      "external-ref-code": "VP, Sales"
    },
    "employee-type": "",
    "default-expense-region": "",
    "default-geo-spend": "",
    "notes": "",
    "exclude-from-autosarf": "",
    "roles": [
      {
        "id": 10,
        "name": "Expense User"
      }
    ],
    "manager": {
      "id": 838,
      "login": "john.doe",
      "email": "staging@coupa.com"
    },
    "default-currency": {
      "id": 1,
      "code": "USD"
    },
    "department": {
      "id": 342,
      "name": "Sales - Exec:176"
    },
    "expenses-delegated-to": [],
    "can-expense-for": [],
    "content-groups": [],
    "account-groups": [],
    "approval-groups": [],
    "working-warehouses": [],
    "inventory-organizations": [],
    "created-by": {
      "id": 2748,
      "login": "user1 creator",
      "email": "user1.creator@company.com"
    },
    "updated-by": {
      "id": 2748,
      "login": "user1 creator",
      "email": "user1.creator@company.com"
    }
  }
]  

我尝试过的是:

https://unknownserver-test.coupahost.com/api/users?user[manager][id]=838&return_object=shallow
https://unknownserver-test.coupahost.com/api/users?manager[id]=838&return_object=shallow
https://unknownserver-test.coupahost.com/api/users?users[user][manager][id]=838&return_object=shallow

1 个答案:

答案 0 :(得分:0)

https://{{URL PREFIX}}.{{HOST}}.com/api/users?manager_id=838&return_object=shallow

如果您只需要用户的ID,那么return_object=limited

可以获得更好的效果

如果返回的用户超过50个,则必须使用偏移量查询参数进行分页。