When a new employee starts at our company, wouldn't it be great if we could quickly grant them access to all of our Heroku applications? We can write programs using the API to do this using the collaborator endpoint. In this recipe, we'll learn how to add and remove collaborators from our applications.
Note
Make sure you complete reading the Getting Started with the Platform API gem recipe before attempting this recipe.
To start, let's open a terminal and go to our heroku-api-examples
directory. Then, we can perform the following steps:
Let's start up a console by running
console.rb
:$ ruby console.rb
With the collaborator's endpoint, we can list, create, or delete collaborators for any of our applications. Let's use the
list
command to see the current collaborators on one of our applications:$ heroku_api.collaborator.list('app-name')
=> [{"created_at"=>"2014-04-20T22:32:57Z", "id"=>"059e7a76-ce3a-4e54-b655-54e3e8e2f253", "updated_at...