1
1

More than 3 years have passed since last update.

Box APIで、外部ユーザーを取得するやりかた

Last updated at Posted at 2020-04-22

Boxで外部のユーザーを取るやり方(box-node-sdkの場合)

box-node-sdkをつかって、外部ユーザーを取得するやりかたがわからなかったので調べました。
他のSDKでも考え方は同じはず。

以下やり方。

const boxSDK = require("box-node-sdk");
const config = require("./config"); // config.json

const main = async () => {
  const sdk = boxSDK.getPreconfiguredInstance(config);
  const saClient = await sdk.getAppAuthClient("enterprise");

  const anExternalUser = await saClient.enterprise.getUsers({
    filter_term: "taro.yamada@example.com",
    user_type: "external",
  });
  console.log(anExternalUser);
};

main();

ポイントは、filter_termnameもしくはloginを完全な形で入れることと、user_typeexternalを指定することみたいです。
外部ユーザーの取得は、1レコードずつしか取れないようですね。

1レコードずつしか取れないのはいいとして、そもそも、名前とかLoginをどうやって取得するんだって話もあります・・・。
コラボレーションとかから引っ張ってくる感じなのかなと想像しますが、今度調べときます。

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1