What is the owner parameter for?


I can see that the owner field is used in multiple places as a parameter or in the returned data. Also some endpoints like the teams endpoint require the org field. What is the significance of the owner field. If I had to guess I would say that the owner refers to the account (organisation or user) that that particular resource belongs to in the url. Am I correct?

Also, how do I get the owners from an installation resource. Right now, I can see that the installation resource returns an account object which has a login field which looks very much like the username or organisation name used in the urls. Is it fine to use that value as the owner value?

@sayakmukhopadhyay - That’s correct! :+1:

This is a great question. Before sharing any specific advice, I’m wondering which endpoint are you asking about, and which specific resource are you interested in that would require the use of the name of the account as the owner value?

cc: https://docs.github.com/en/rest/reference/apps

I using the installation.created webhook https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation. Essentially, I would like to get the reference to the organisation/user account where the installation of my bot is happening so that I can call other queries which needs the organisation name like to get the content of a repository https://docs.github.com/en/rest/reference/repos#get-repository-content. I was wondering if I can use the account.login field from the installation.created webhook in the owner field of the get-repository-content API call.

@sayakmukhopadhyay - Thanks for sharing that additional context! The value of account.login in that payload tells you who the owner of the repositories the application was just installed to.

However, knowing solely the owner is not enough to get repository content, since that endpoint also requires the name of the repository ({repo}) and the path ({path}).

It may be helpful to note here we have an Installations API that enables you to get information about the installations of your GitHub App and perform actions within those installations. In that API, there’s an endpoint for listing repositories accessible to the app installation. That can be helpful to determine which repositories your installation has access to at any given time before making any specific calls to any one repository. I hope this helps!

1 Like

Hi @francisfuzz
Thanks for the clarification. I am already using the Installations API to get the list of repositories the installation has access to. My concern was reliably getting the owner info which as you clarified can be got from the account.login field. Thanks a lot for taking the time to help. Appreciate it!

1 Like