新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

コメント

2件のコメント

  • rocks

    Hi ,

     

    I don't think there is a specific query parameter on the user endpoint to pass filter date but please jump in and correct me if this is wrong.  There are two ways you can think about achieving this.

     

    1) Return all users in enterprise (paging through results), store these temporarily in memory / application db and then inspect field called "created_at" to find the users you need.

     

     

    GET https://api.box.com/2.0/users
    
    {
    "type": "user",
    "id": "277627745",
    "name": "Peter",
    "login": "rocks@box.com",
    "created_at": "2016-05-13T02:24:27-07:00",
    "modified_at": "2016-05-13T02:24:27-07:00",
    "language": "en",
    "timezone": "Pacific/Honolulu",
    "space_amount": 53687091200,
    "space_used": 0,
    "max_upload_size": 5368709120,
    "status": "active",
    "job_title": "",
    "phone": "",
    "address": "",
    "avatar_url": "https://rocks-demo.app.box.com/api/avatar/large/277627745"
    },

     

     

    2) Make a specific all to the Admin Events Stream to ask for all events where a new user object has been created.  With Events stream you can further narrow the result set by adding query parameter "&created_after=20161020T12:00:00"

     

    ...events?stream_type=admin_logs&event_type=NEW_USER&created_after=xxx

     

    In the Event stream response you will not see the entire user object but you will be able to grab user id, name and login which should be enough.

     

    curl --request GET \
    --url 'https://api.box.com/2.0/events?stream_type=admin_logs&event_type=NEW_USER&created_after=20161020T12%3A00%3A00' \
    --header 'authorization: Bearer ACCESS_TOKEN' \
    
    {
    "chunk_size": 1,
    "next_stream_position": "1152922982164821267",
    "entries": [
    {
    "source": {
    "type": "user",
    "id": "407004000",
    "name": "Egon Ridley",
    "login": "rocks+mob@box.com"
    },
    "created_by": {
    "type": "user",
    "id": "218285068",
    "name": "Admin User",
    "login": "rocks+demo@box.com"
    },
    "created_at": "2016-10-26T22:46:14-10:00",
    "event_id": "2594796a-b069-4e16-805f-f53a37ee53ae",
    "event_type": "NEW_USER",
    "ip_address": "Unknown IP",
    "type": "event",
    "session_id": null,
    "additional_details": null
    }
    ]
    }
    
    0
    コメントアクション Permalink
  • aservania

    thanks Rock for sharing your ideas its a big help,

    i'm working on the first option you provided. for the second option it says that i have insuficient permission.

    0
    コメントアクション Permalink

サインインしてコメントを残してください。