APIPortal / Client / create_product

create_product

APIPortal.Client.create_product(**kwargs)

Creates a product. A product groups Managed APIs with their API pages and product pages so a portal can publish them together.

See also: AWS API Documentation

Request Syntax

response = client.create_product(
    displayName='string',
    description='string',
    tags={
        'string': 'string'
    },
    apiSelectionConfiguration={
        'apiSelectionMode': 'CUSTOM'|'RULE_BASED',
        'ruleFilters': [
            {
                'key': 'RESOURCE_ARN'|'HOST'|'METHOD'|'PATH'|'PORT'|'ACCOUNT',
                'values': [
                    'string',
                ]
            },
        ]
    }
)
Parameters:
  • displayName (string) –

    [REQUIRED]

    The name of the product, from 1 to 255 characters.

  • description (string) – A description of the product, up to 1024 characters.

  • tags (dict) –

    Up to 50 tags per request, matching API Gateway’s limit of 50 tags per resource.

    • (string) –

      A tag key of 1-128 Unicode characters, per the AWS tagging limits.

      • (string) –

        A tag value of 0-256 Unicode characters, per the AWS tagging limits; an empty value is valid.

  • apiSelectionConfiguration (dict) –

    How Managed APIs are selected for the product. The selection mode can’t be changed after the product is created.

    • apiSelectionMode (string) – [REQUIRED]

      How a product’s member Managed APIs are chosen. CUSTOM - the customer associates and disassociates Managed APIs explicitly. RULE_BASED - membership is derived from ruleFilters: every Managed API in the account that matches is associated, and nothing else is. BatchAssociateManagedApi and BatchDisassociateManagedApi are rejected for these products.

      Fixed at create time. UpdateProduct cannot change the mode of an existing product.

    • ruleFilters (list) –

      Required for RULE_BASED, rejected for CUSTOM. Filters are combined with AND, the values within one filter with OR, and evaluated only over the account’s Managed APIs. Replaced as a whole on update, not merged.

      • (dict) –

        Values are compared to the attribute as literals: exact and case-sensitive, no wildcards.

        • key (string) – [REQUIRED]

          The Managed API attribute a RuleFilter compares against. RESOURCE_ARN - apiSignature.resourceArn HOST - apiSignature.hostname METHOD - apiSignature.method, so values must be HttpMethod names PATH - apiSignature.path PORT - apiSignature.port, compared as its decimal string, so values must be 0-65535 with no leading zeros ACCOUNT - the account hosting the API, which for an ORGANIZATION-scoped Managed API is the member account rather than the account that created it

        • values (list) – [REQUIRED]

          The values to match. The filter matches when the attribute equals any of them.

          • (string) –

            Bounded by the longest matchable attribute, apiSignature.path.

            No whitespace: none of the matchable attributes (ARN, hostname, method, path, port, account) contain any. Per-key formats (METHOD, PORT, ACCOUNT) are enforced in ProductValidator.validateRuleFilterValue, since one pattern cannot express them for a value shared by every key.

Return type:

dict

Returns:

Response Syntax

{
    'productId': 'string',
    'productArn': 'string',
    'displayName': 'string',
    'displayOrder': {
        'overviewPageArn': 'string',
        'productPageArns': [
            'string',
        ],
        'contents': [
            {
                'sectionName': 'string',
                'productApiPageArns': [
                    'string',
                ]
            },
        ]
    },
    'description': 'string',
    'updatedAt': datetime(2015, 1, 1),
    'tags': {
        'string': 'string'
    },
    'apiSelectionConfiguration': {
        'apiSelectionMode': 'CUSTOM'|'RULE_BASED',
        'ruleFilters': [
            {
                'key': 'RESOURCE_ARN'|'HOST'|'METHOD'|'PATH'|'PORT'|'ACCOUNT',
                'values': [
                    'string',
                ]
            },
        ]
    },
    'status': 'ACTIVE'|'IN_PROGRESS'|'FAILED',
    'failureReason': 'API_PAGE_ATTACHED'|'EVALUATION_ERROR'
}

Response Structure

  • (dict) –

    • productId (string) –

      The identifier of the product.

    • productArn (string) –

      The ARN of the product.

    • displayName (string) –

      The name of the product, from 1 to 255 characters.

    • displayOrder (dict) –

      The order of the product’s pages and API page sections in the portal navigation.

      • overviewPageArn (string) –

        The ARN of the product page shown as the product overview.

      • productPageArns (list) –

        A product has at most DocHubLimits.DEFAULT_PAGES_PER_PRODUCT_LIMIT (40) pages, enforced by LimitsHelper.

        • (string) –

      • contents (list) –

        Sections in a product’s navigation. No service-side limit exists today; this bound caps request size.

        • (dict) –

          A named group of API pages in the portal navigation.

          • sectionName (string) –

            Shown in the portal navigation. Same bound as page titles and operation names, and no control characters (the service rejects a blank name).

          • productApiPageArns (list) –

            API pages in one section. No service-side limit exists today; this bound caps request size.

            • (string) –

    • description (string) –

      A description of the product, up to 1024 characters.

    • updatedAt (datetime) –

      When the resource was last updated.

    • tags (dict) –

      Up to 50 tags per request, matching API Gateway’s limit of 50 tags per resource.

      • (string) –

        A tag key of 1-128 Unicode characters, per the AWS tagging limits.

        • (string) –

          A tag value of 0-256 Unicode characters, per the AWS tagging limits; an empty value is valid.

    • apiSelectionConfiguration (dict) –

      How Managed APIs are selected for the product.

      • apiSelectionMode (string) –

        How a product’s member Managed APIs are chosen. CUSTOM - the customer associates and disassociates Managed APIs explicitly. RULE_BASED - membership is derived from ruleFilters: every Managed API in the account that matches is associated, and nothing else is. BatchAssociateManagedApi and BatchDisassociateManagedApi are rejected for these products.

        Fixed at create time. UpdateProduct cannot change the mode of an existing product.

      • ruleFilters (list) –

        Required for RULE_BASED, rejected for CUSTOM. Filters are combined with AND, the values within one filter with OR, and evaluated only over the account’s Managed APIs. Replaced as a whole on update, not merged.

        • (dict) –

          Values are compared to the attribute as literals: exact and case-sensitive, no wildcards.

          • key (string) –

            The Managed API attribute a RuleFilter compares against. RESOURCE_ARN - apiSignature.resourceArn HOST - apiSignature.hostname METHOD - apiSignature.method, so values must be HttpMethod names PATH - apiSignature.path PORT - apiSignature.port, compared as its decimal string, so values must be 0-65535 with no leading zeros ACCOUNT - the account hosting the API, which for an ORGANIZATION-scoped Managed API is the member account rather than the account that created it

          • values (list) –

            The values to match. The filter matches when the attribute equals any of them.

            • (string) –

              Bounded by the longest matchable attribute, apiSignature.path.

              No whitespace: none of the matchable attributes (ARN, hostname, method, path, port, account) contain any. Per-key formats (METHOD, PORT, ACCOUNT) are enforced in ProductValidator.validateRuleFilterValue, since one pattern cannot express them for a value shared by every key.

    • status (string) –

      Whether the product’s member APIs match its apiSelectionConfiguration. ACTIVE - membership matches. The only status a CUSTOM product reports. IN_PROGRESS - ruleFilters changed and membership is still being evaluated. FAILED - evaluation could not finish and membership is incomplete; failureReason says why.

    • failureReason (string) –

      Reason a product’s rules could not be fully applied, present only when status is FAILED. New reasons may be added over time, so clients MUST treat any unrecognized value as UNKNOWN and fall back to generic handling.

Exceptions