create method

Creates an API product in an organization.

You create API products after you have proxied backend services using API proxies. An API product is a collection of API resources combined with quota settings and metadata that you can use to deliver customized and productized API bundles to your developer community. This metadata can include: - Scope - Environments - API proxies - Extensible profile API products enable you repackage APIs on the fly, without having to do any additional coding or configuration. Apigee recommends that you start with a simple API product including only required elements. You then provision credentials to apps to enable them to start testing your APIs. After you have authentication and authorization working against a simple API product, you can iterate to create finer-grained API products, defining different sets of API resources for each API product. WARNING: - If you don't specify an API proxy in the request body, any app associated with the product can make calls to any API in your entire organization.

  • If you don't specify an environment in the request body, the product allows access to all environments. For more information, see What is an API product?

request - The metadata request object.

Request parameters:

parent - Required. Name of the organization in which the API product will be created. Use the following structure in your request: organizations/{org} Value must have pattern ^organizations/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleCloudApigeeV1ApiProduct.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<GoogleCloudApigeeV1ApiProduct> create(
  GoogleCloudApigeeV1ApiProduct request,
  core.String parent, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/apiproducts';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return GoogleCloudApigeeV1ApiProduct.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}