Skip to content

create_product_api_page async

create_product_api_page(
    product_id: ProductId,
    managed_api_id: ManagedApiId,
    *,
    config_overrides: Optional[AsyncAPIPortalClientConfig] = None,
    display_content: Optional[ApiPageDisplayContent] = None,
    try_it_state: Optional[TryItState] = None,
    tags: Optional[Tags] = None,
) -> CreateProductApiPageResponse

Creates an API page that documents a Managed API in a product. The page content is generated asynchronously. Use status to track it.

Parameters:

  • product_id (ProductId) –

    The identifier of the product.

  • managed_api_id (ManagedApiId) –

    The Managed API this page documents. It must already be associated with the product, and the page's API identifier is taken from the Managed API rather than supplied by the caller.

  • try_it_state (Optional[TryItState], default: None ) –

    Whether readers can call the API from the page with Try-It. Defaults to DISABLED. To enable it, the page's API URL must use HTTPS on a domain that supports Try-It.

Raises:

Source code in docs_src/capo_apiportal/_services/async_api_portal.py
async def create_product_api_page(
    self,
    product_id: "capo_apiportal.types.product_id.ProductId",
    managed_api_id: "capo_apiportal.types.managed_api_id.ManagedApiId",
    *,
    config_overrides: Optional[AsyncAPIPortalClientConfig] = None,
    display_content: Optional[
        "capo_apiportal.types.api_page_display_content.ApiPageDisplayContent"
    ] = None,
    try_it_state: Optional["capo_apiportal.types.try_it_state.TryItState"] = None,
    tags: Optional["capo_apiportal.types.tags.Tags"] = None,
) -> "capo_apiportal.types.create_product_api_page_response.CreateProductApiPageResponse":
    """Creates an API page that documents a Managed API in a product. The page content is generated asynchronously. Use `status` to track it.

    Args:
        product_id: The identifier of the product.
        managed_api_id: The Managed API this page documents. It must already be associated with the product, and the page's API identifier is taken from the Managed API rather than supplied by the caller.
        try_it_state: Whether readers can call the API from the page with Try-It. Defaults to `DISABLED`. To enable it, the page's API URL must use HTTPS on a domain that supports Try-It.

    Raises:
        capo_apiportal.errors.access_denied_exception.AccessDeniedException: You do not have permission to perform this operation.
        capo_apiportal.errors.bad_request_exception.BadRequestException: The request is not valid. The message identifies the field or value that failed validation.
        capo_apiportal.errors.limit_exceeded_exception.LimitExceededException: The request rate or a service quota was exceeded. Reduce the request rate or the number of resources and try again.
        capo_apiportal.errors.resource_not_found_exception.ResourceNotFoundException: The requested resource does not exist, or you do not have access to it.
        capo_apiportal.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_apiportal.types.create_product_api_page_request.CreateProductApiPageRequest]",
    ) -> AsyncOperationResponse[
        "capo_apiportal.types.create_product_api_page_response.CreateProductApiPageResponse"
    ]:
        import capo_apiportal._operations.api_portal_control_service.create_product_api_page

        (
            output,
            http_response,
        ) = await capo_apiportal._operations.api_portal_control_service.create_product_api_page.async_create_product_api_page(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateProductApiPage")
    )
    input_: capo_apiportal.types.create_product_api_page_request.CreateProductApiPageRequest = {
        "product_id": product_id,
        "managed_api_id": managed_api_id,
    }
    if display_content is not None:
        input_["display_content"] = display_content
    if try_it_state is not None:
        input_["try_it_state"] = try_it_state
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output