Skip to content

API Product Service

This service provides methods to create, update, delete, get, list API Products.

Usage

php
use \Lordjoo\Apigee\Facades\Apigee;
$apiProductService = Apigee::edge()->apiProduct();
use \Lordjoo\Apigee\Facades\Apigee;
$apiProductService = Apigee::edge()->apiProduct();

List all API Products

Using the get method, you can get all API Products in your organization.

php
$products = $apiProductService->get();
$products = $apiProductService->get();

$products is a Laravel Collection of ApiProduct objects.

Get an API Product

Using the find method, you can get an API Product by it's name.

php
$product = $apiProductService->find('my-product');
$product = $apiProductService->find('my-product');

$product is an instance of ApiProduct object.

Create an API Product

Using the create method, you can create an API Product, the create method accepts one parameter $data which is an array of the API Product properties APIProductRequest

php
$product = $apiProductService->create($data);
$product = $apiProductService->create($data);

the returned $product is an instance of ApiProduct object, we also throw an exception if the API Product is not created successfully.

Update an API Product

Using the update method, you can update an API Product, the update method accepts two parameters $name and $data where $name is the name of the API Product you want to update and $data is an array of the API Product properties APIProductRequest

php
$product = $apiProductService->update($name, $data);
$product = $apiProductService->update($name, $data);

Note

The create and update method will do a validation check on the data you passed, so if you passed an invalid data, the method will throw a validation exception.

Delete an API Product

Using the delete method, you can delete an API Product by it's name.

php
$apiProductService->delete($name);
$apiProductService->delete($name);

Entity

Properties

PropertyTypeDescription
namestringName of the API Product
displayNamestringDisplay name of the API Product
descriptionstringDescription of the API Product
approvalTypestringApproval type of the API Product
attributesAttribute[]Attributes of the API Product
proxiesstring[]Proxies of the API Product
environmentsstring[]Environments of the API Product
apiResourcesstring[]API Resources of the API Product
quotaQuotaQuota of the API Product
quotaIntervalstringQuota interval of the API Product
quotaTimeUnitstringQuota time unit of the API Product
scopesstring[]Scopes of the API Product

Methods

We also provide some helper methods to make it easier to work with the API Product entity.

Update the API Product

Using the update method, you can update an API Product, the update method accepts one parameter $data which is an array of the API Product properties APIProductRequest

php
$product->update($data);
$product->update($data);

Delete the API Product

Using the delete method, you can delete an API Product.

php
$product->delete();
$product->delete();

Released under the MIT License.