メインコンテンツへスキップ

assign-contract-template

dci assign-contract-template <templateID> [body]

Applies a contract template owned by the authenticated tenant (from the bearer token) to child customers, creating a draft contract for each. Drafts have no billing effect until each one is completed and activated. The template must not be archived, and the current date must fall within its eligibility window. Requires ContractTemplatesAdmin, DoiT API access (platform:externalApi), and the channelops:contracts:templates entitlement.

  • templateID — Identifier of the contract template to apply.

Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.

Request

Content-Type: application/json

FieldTypeRequiredDescription
customerIdsarray of stringyesIdentifiers of the customers to create a draft contract for. Each identifier must name a tenant within the authenticated tenant's own hierarchy, of the tier one level below it: a distributor supplies resellers, a reseller supplies end customers. Repeated identifiers are ignored, and a customer already holding a contract from this template receives another draft.
Raw JSON schema
{
"type": "object",
"description": "The customers a contract template is applied to.",
"required": [
"customerIds"
],
"properties": {
"customerIds": {
"type": "array",
"description": "Identifiers of the customers to create a draft contract for. Each identifier must name a tenant within the authenticated tenant's own hierarchy, of the tier one level below it: a distributor supplies resellers, a reseller supplies end customers. Repeated identifiers are ignored, and a customer already holding a contract from this template receives another draft.",
"minItems": 1,
"maxItems": 250,
"items": {
"type": "string"
}
}
}
}

Output

Created - Draft contracts created for the specified customers.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
countintegerNumber of draft contracts created.
createdContractsarray of objectOne entry per created draft contract, in the order the customers were supplied.
createdContracts[].customerIdstringIdentifier of the customer the draft contract was created for.
createdContracts[].contractIdstringIdentifier of the created draft contract.
Raw JSON schema
{
"type": "object",
"description": "The draft contracts created by applying a contract template.",
"properties": {
"count": {
"type": "integer",
"description": "Number of draft contracts created."
},
"createdContracts": {
"type": "array",
"description": "One entry per created draft contract, in the order the customers were supplied.",
"items": {
"type": "object",
"description": "A draft contract created from a contract template.",
"properties": {
"customerId": {
"type": "string",
"description": "Identifier of the customer the draft contract was created for."
},
"contractId": {
"type": "string",
"description": "Identifier of the created draft contract."
}
}
}
}
}
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
40921RESOURCE_CONFLICTThe operation conflicts with the resource's current state.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: assigncontracttemplate