hare krshn
hare krshn

Reputation: 386

create github organisation using API

I am trying to create organisation using github enterprise API, i am following this -

https://docs.github.com/en/[email protected]/rest/reference/enterprise-admin#create-an-organization

Below is the API tried :

curl -u acme-admin:token  -X POST   -H "Accept: application/vnd.github.v3+json"   https://acme.example.com/api/v3/admin/organizations   -d '{"login":"acme-admin","admin":"acme-admin","profile_name":"exampleorg"}'

Response is as shown below, do any one have any clue about this ? the user "acme-admin" exists in the github enterprise and this user is administrator only.

{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Organization",
      "code": "custom",
      "field": "login",
      "message": "login is not available"
    },
    {
      "resource": "Organization",
      "code": "missing_field",
      "field": "admins"
    }
  ],
  "documentation_url": "https://docs.github.com/enterprise/2.22/user/rest/reference/enterprise-admin#create-an-organization"
}

Upvotes: 0

Views: 635

Answers (1)

VonC
VonC

Reputation: 1323953

A similar script mentions:

curl -i -H "Authorization: token $gitub_api_token" ...

You can see that header defined in "REST API / Other authentication methods".
Check if this works better than -u acme-admin:token.

Upvotes: 1

Related Questions