BrandsApi
extends ResourceApi
in package
Brands API
For management of Brands.
Example for finding and deleting all brands with id less than 100:
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);
$brandsToDelete = $api->catalog()->brands()->getAllPages(['id:less' => 100])->getBrands();
foreach ($brandsToDelete as $brand) {
$api->catalog()->brand($brand->id)->delete();
}
Tags
Table of Contents
- FILTER_EXCLUDE_FIELDS = 'exclude_fields'
- FILTER_INCLUDE_FIELDS = 'include_fields'
- __construct() : mixed
- create() : BrandResponse
- Creates a Brand.
- delete() : ResponseInterface
- get() : BrandResponse
- Returns a single Brand.
- getAll() : BrandsResponse
- Returns a list of Brands.
- getAllPages() : BrandsResponse
- Get all brands, fetching multiple pages
- getClient() : Client
- getParentResourceId() : int|null
- getResourceId() : int|null
- image() : BrandImageApi
- Get the Brand Image API for this brand
- metafield() : BrandMetafieldsApi
- Get the singular Brand Metafields API
- metafields() : BrandMetafieldsApi
- Get the Plural BrandMetafields API
- multipleResourceUrl() : string
- singleResourceUrl() : string
- update() : BrandResponse
- Update a Brand
Constants
FILTER_EXCLUDE_FIELDS
public
mixed
FILTER_EXCLUDE_FIELDS
= 'exclude_fields'
Tags
FILTER_INCLUDE_FIELDS
public
mixed
FILTER_INCLUDE_FIELDS
= 'include_fields'
Tags
Methods
__construct()
public
__construct(Client $client[, int|null $resourceId = null ][, int|null $parentResourceId = null ]) : mixed
Parameters
- $client : Client
- $resourceId : int|null = null
- $parentResourceId : int|null = null
Tags
Return values
mixed —create()
Creates a Brand.
public
create(Brand $brand) : BrandResponse
Example:
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);
$brand = new BigCommerce\ApiV3\ResourceModels\Catalog\Brand\Brand();
$brand->name = "My Brand";
$brand->meta_description = "My wonderful brand";
$api->catalog()->brands()->create($brand);
Parameters
- $brand : Brand
Tags
Return values
BrandResponse —Response will contain the created brand (i.e. it will include an id)
delete()
public
delete() : ResponseInterface
Tags
Return values
ResponseInterface —get()
Returns a single Brand.
public
get([array<string|int, string>|null $include_fields = null ][, array<string|int, string>|null $exclude_fields = null ]) : BrandResponse
Optionally it is possible to specify fields to be include or excluded from results.
Parameters
- $include_fields : array<string|int, string>|null = null
-
Fields to include, in a comma-separated list. The ID and the specified fields will be returned.
- $exclude_fields : array<string|int, string>|null = null
-
Fields to exclude, in a comma-separated list. The specified fields will be excluded from a response. The ID cannot be excluded.
Tags
Return values
BrandResponse —getAll()
Returns a list of Brands.
public
getAll([array<string, mixed> $filters = [] ][, int $page = 1 ][, int $limit = 250 ]) : BrandsResponse
Optional filter parameters can be passed in.
Parameters
- $filters : array<string, mixed> = []
-
Array of optional features. For available filters, see https://developer.bigcommerce.com/api-reference/store-management/catalog/brands/getbrands
- $page : int = 1
-
The page number to be fetched
- $limit : int = 250
-
Maximum brands per page returned
Tags
Return values
BrandsResponse —getAllPages()
Get all brands, fetching multiple pages
public
getAllPages([array<string|int, mixed> $filter = [] ]) : BrandsResponse
Collates the results of all pages into a single response.
Parameters
- $filter : array<string|int, mixed> = []
-
Array of optional features. For available filters, see https://developer.bigcommerce.com/api-reference/store-management/catalog/brands/getbrands
Tags
Return values
BrandsResponse —getClient()
public
getClient() : Client
Tags
Return values
Client —getParentResourceId()
public
getParentResourceId() : int|null
Tags
Return values
int|null —getResourceId()
public
getResourceId() : int|null
Tags
Return values
int|null —image()
Get the Brand Image API for this brand
public
image() : BrandImageApi
Example
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);
$brandImageApi = $api->catalog()->brand(123)->image();
Tags
Return values
BrandImageApi —metafield()
Get the singular Brand Metafields API
public
metafield(int $id) : BrandMetafieldsApi
For actions on a specific metafield for a brand.
Parameters
- $id : int
Tags
Return values
BrandMetafieldsApi —metafields()
Get the Plural BrandMetafields API
public
metafields() : BrandMetafieldsApi
For actions on all metafields related to this brand.
Tags
Return values
BrandMetafieldsApi —multipleResourceUrl()
public
abstract multipleResourceUrl() : string
Tags
Return values
string —singleResourceUrl()
public
abstract singleResourceUrl() : string
Tags
Return values
string —update()
Update a Brand
public
update(Brand $brand) : BrandResponse
Example:
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);
$brand = $api->catalog()->brand(123)->get()->getBrand();
$brand->meta_description .= " with some more information";
$api->catalog()->brand(123)->update($brand);
Parameters
- $brand : Brand