0

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"
}
1
  • Hi, Are you able to create a user without organization? Commented May 16, 2022 at 18:38

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes - just tried using curl -i -H "Authorization: token $gitub_api_token" ...i still encounter this same issue especially same error as mentioned above. We are trying to find the way to automate the workflow without manual intervention.
@harekrshn Strange. Is it possible the token has not the correct right for creating organization?
Can you confirm which token i should use ? I manually created the token using developer settings -> personal access tokens -> generated token with all admin privileges. Is this right one ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.