Bug? REST Admin endpoint returning Teams


#1

Testing out the REST API this evening, I saw (what seemed to me) to be some unexpected behavior.

Listing admins using the following:

$ curl https://api.intercom.io/admins \
-H 'Authorization:Bearer <redacted-token>' \
-H 'Accept: application/json'

I’m seeing a response that includes both admins and teams. I’ve slightly redacted some of the info in this example, but note the “type”: “team” below:

{
  "type": "admin.list",
  "admins": [
    {
      "type": "admin",
      "email": "admin@example.com",
      "id": "1",
      "name": "Admin Name",
      "away_mode_enabled": false,
      "away_mode_reassign": false,
      "team_ids": [
        2
      ]
    },
    {
      "type": "team",
      "email": null,
      "id": "2",
      "name": "Test",
      "away_mode_enabled": false,
      "away_mode_reassign": false,
      "admin_ids": [
        1
      ]
    }
  ]
}

Am I missing some important detail in my reading of the documentation?


#2

Hey @bruce :wave:

Yeah, it’s expected for now. The /teams endpoint is relatively new, but the /admins endpoint was what was used originally to list both admins and team. Therefore, we didn’t want top issue a breaking change to this endpoint for customers who were using this original endpoint for that purpose.

100% right that it’s not ideal behaviour though - in the short term it’s difficult, but we’ll definitely tidy this up soon :100: