I'm trying to figure out how to create a cost center for an Organization in GitHub, using its API.
I looked all over the documentation and only found how to list cost centers (using Rest API):
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $token" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/companyname/settings/billing/cost-centers
and I'm getting response like this:
"costCenters": [
{
"id": "e6c14655-71eb-472a-b1db-0000000",
"name": "some-name",
"resources": [
{
"type": "Org",
"name": "full-name-here"
}
]
},
Also looked into the GraphQL API and mutations especially and don't see how to create a cost center..
Tried to look for something in GraphQL explorer but also nothing.
Is it possible to create a cost center using GitHub API? I need to automate creating them (all organizations have to have a cost center assigned and I need to keep them in sync).
It looks like there is neither REST nor GraphQL API to manage cost centres for a GitHub Enterprise. The only other option to automate cost centre creation/management is to use GitHub UI and browser automation tools like Selenium.