Ana içeriğe geç

Create Consumer Organization

Endpoint​

POST /apiops/projects/{projectName}/consumer-organizations

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Request Body​

{
"code": "acme-partners",
"nameDefault": "ACME Partners",
"nameSecondary": "ACME Ortaklar",
"parentOrganizationCode": "acme",
"metadata": [
{ "key": "region", "value": "emea", "secret": false }
]
}
FieldTypeRequiredDescription
codestringYesCode of the organization. Stored trimmed. Unique in the project
nameDefaultstringNoDefault display name
nameSecondarystringNoSecondary display name
parentOrganizationCodestringNoCode of an organization of the same project. An unknown code answers 404 resourceNotFound
metadataarrayNoCustom metadata entries (key, value, secret, includeInJwt, includeInTokenResponse, jwtClaimName). The value of a secret entry is write-only

Response​

201 Created with a Location header (/apiops/projects/{projectName}/consumer-organizations/{code}).

The response is a write response. result is the organization. runtimeDeployment reports the gateway push (IN_SYNC or DEGRADED). A DEGRADED write is stored. resourceVersion is not returned.

Errors​

StatusError keyCause
400malformedRequestcode is missing
404resourceNotFoundThe parent organization code is unknown
409duplicateNameThe code is already used in the project

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/consumer-organizations" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "code": "acme-partners", "nameDefault": "ACME Partners" }'

Permissions​

  • User must have IDENTITY + MANAGE permission in the project
  • A project outside the scope of the caller answers 404 resourceNotFound, never 403
  • The admin project has no consumer organizations: a call on it answers 400 malformedRequest (params.reason = platformScopeNotSupported)