christian71-stack / ebay-inventory-api
1.18.0
2024-11-26 09:02 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2025-04-16 18:29:48 UTC
README
The Inventory API is used to create and manage inventory, and then to publish and manage this inventory on an eBay marketplace. There are also methods in this API that will convert eligible, active eBay listings into the Inventory API model.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.17.2
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Requirements
PHP 5.5 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/christian71-stack/ebay-sell-inventory-php-client.git"
}
],
"require": {
"christian71-stack/ebay-sell-inventory-php-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to//vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Ebay\Sell\Inventory\Model\BulkInventoryItem(); // \Ebay\Sell\Inventory\Model\BulkInventoryItem | Details of the inventories with sku and locale $content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. $content_language = "content_language_example"; // string | This header sets the natural language that will be used in the field values of the request payload. For example, the value passed in this header should be <code>en-US</code> for English or <code>de-DE</code> for German.<br><br>For more information on the Content-Language header, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. try { $result = $apiInstance->bulkCreateOrReplaceInventoryItem($body, $content_type, $content_language); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->bulkCreateOrReplaceInventoryItem: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Ebay\Sell\Inventory\Model\BulkGetInventoryItem(); // \Ebay\Sell\Inventory\Model\BulkGetInventoryItem | Details of the inventories with sku and locale $content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. try { $result = $apiInstance->bulkGetInventoryItem($body, $content_type); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->bulkGetInventoryItem: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Ebay\Sell\Inventory\Model\BulkPriceQuantity(); // \Ebay\Sell\Inventory\Model\BulkPriceQuantity | Price and allocation details for the given SKU and Marketplace $content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. try { $result = $apiInstance->bulkUpdatePriceQuantity($body, $content_type); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->bulkUpdatePriceQuantity: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Ebay\Sell\Inventory\Model\InventoryItem(); // \Ebay\Sell\Inventory\Model\InventoryItem | Details of the inventory item record. $content_language = "content_language_example"; // string | This header sets the natural language that will be used in the field values of the request payload. For example, the value passed in this header should be <code>en-US</code> for English or <code>de-DE</code> for German.<br><br>For more information on the Content-Language header, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. $content_type = "content_type_example"; // string | This header indicates the format of the request body provided by the client. Its value should be set to <b>application/json</b>. <br><br> For more information, refer to <a href=\"/api-docs/static/rest-request-components.html#HTTP\" target=\"_blank \">HTTP request headers</a>. $sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value for the inventory item being created or updated. SKU values must be unique across the seller's inventory. <br><br> <strong>Max length</strong>: 50 try { $result = $apiInstance->createOrReplaceInventoryItem($body, $content_language, $content_type, $sku); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->createOrReplaceInventoryItem: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value of the product whose inventory item record you wish to delete.<br><br>Use the <a href=\"/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems\" target=\"_blank \">getInventoryItems</a> method to retrieve SKU values.<br><br><strong>Max length</strong>: 50 try { $apiInstance->deleteInventoryItem($sku); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->deleteInventoryItem: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $sku = "sku_example"; // string | This path parameter specifies the seller-defined SKU value of the product whose inventory item record you wish to retrieve.<br><br>Use the <a href=\"/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems\" target=\"_blank \">getInventoryItems</a> method to retrieve SKU values.<br><br><strong>Max length</strong>: 50 try { $result = $apiInstance->getInventoryItem($sku); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->getInventoryItem: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: api_auth $config = Ebay\Sell\Inventory\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Ebay\Sell\Inventory\Api\InventoryItemApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $limit = "limit_example"; // string | The value passed in this query parameter sets the maximum number of records to return per page of data. Although this field is a string, the value passed in this field should be an integer from <code>1</code> to <code>100</code>. <br><br><strong>Min</strong>: 1<br><br><strong>Max</strong>: 100<br><br><b>Default</b>: 25 $offset = "offset_example"; // string | The value passed in this query parameter sets the page number to retrieve. The first page of records has a value of <code>0</code>, the second page of records has a value of <code>1</code>, and so on. If this query parameter is not set, its value defaults to <code>0</code>, and the first page of records is returned. try { $result = $apiInstance->getInventoryItems($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling InventoryItemApi->getInventoryItems: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://api.ebay.com{basePath}
Class | Method | HTTP request | Description |
---|---|---|---|
InventoryItemApi | bulkCreateOrReplaceInventoryItem | POST /bulk_create_or_replace_inventory_item | |
InventoryItemApi | bulkGetInventoryItem | POST /bulk_get_inventory_item | |
InventoryItemApi | bulkUpdatePriceQuantity | POST /bulk_update_price_quantity | |
InventoryItemApi | createOrReplaceInventoryItem | PUT /inventory_item/{sku} | |
InventoryItemApi | deleteInventoryItem | DELETE /inventory_item/{sku} | |
InventoryItemApi | getInventoryItem | GET /inventory_item/{sku} | |
InventoryItemApi | getInventoryItems | GET /inventory_item | |
InventoryItemGroupApi | createOrReplaceInventoryItemGroup | PUT /inventory_item_group/{inventoryItemGroupKey} | |
InventoryItemGroupApi | deleteInventoryItemGroup | DELETE /inventory_item_group/{inventoryItemGroupKey} | |
InventoryItemGroupApi | getInventoryItemGroup | GET /inventory_item_group/{inventoryItemGroupKey} | |
ListingApi | bulkMigrateListing | POST /bulk_migrate_listing | |
LocationApi | createInventoryLocation | POST /location/{merchantLocationKey} | |
LocationApi | deleteInventoryLocation | DELETE /location/{merchantLocationKey} | |
LocationApi | disableInventoryLocation | POST /location/{merchantLocationKey}/disable | |
LocationApi | enableInventoryLocation | POST /location/{merchantLocationKey}/enable | |
LocationApi | getInventoryLocation | GET /location/{merchantLocationKey} | |
LocationApi | getInventoryLocations | GET /location | |
LocationApi | updateInventoryLocation | POST /location/{merchantLocationKey}/update_location_details | |
OfferApi | bulkCreateOffer | POST /bulk_create_offer | |
OfferApi | bulkPublishOffer | POST /bulk_publish_offer | |
OfferApi | createOffer | POST /offer | |
OfferApi | deleteOffer | DELETE /offer/{offerId} | |
OfferApi | getListingFees | POST /offer/get_listing_fees | |
OfferApi | getOffer | GET /offer/{offerId} | |
OfferApi | getOffers | GET /offer | |
OfferApi | publishOffer | POST /offer/{offerId}/publish/ | |
OfferApi | publishOfferByInventoryItemGroup | POST /offer/publish_by_inventory_item_group/ | |
OfferApi | updateOffer | PUT /offer/{offerId} | |
OfferApi | withdrawOffer | POST /offer/{offerId}/withdraw | |
OfferApi | withdrawOfferByInventoryItemGroup | POST /offer/withdraw_by_inventory_item_group | |
ProductCompatibilityApi | createOrReplaceProductCompatibility | PUT /inventory_item/{sku}/product_compatibility | |
ProductCompatibilityApi | deleteProductCompatibility | DELETE /inventory_item/{sku}/product_compatibility | |
ProductCompatibilityApi | getProductCompatibility | GET /inventory_item/{sku}/product_compatibility |
Documentation For Models
- Address
- Amount
- Availability
- AvailabilityDistribution
- AvailabilityWithAll
- BaseResponse
- BestOffer
- BulkEbayOfferDetailsWithKeys
- BulkGetInventoryItem
- BulkGetInventoryItemResponse
- BulkInventoryItem
- BulkInventoryItemResponse
- BulkMigrateListing
- BulkMigrateListingResponse
- BulkOffer
- BulkOfferResponse
- BulkPriceQuantity
- BulkPriceQuantityResponse
- BulkPublishResponse
- Charity
- Compatibility
- CompatibleProduct
- ConditionDescriptor
- CountryPolicy
- Dimension
- EbayOfferDetailsWithAll
- EbayOfferDetailsWithId
- EbayOfferDetailsWithKeys
- EnergyEfficiencyLabel
- Error
- ErrorParameter
- ExtendedProducerResponsibility
- Fee
- FeeSummary
- FeesSummaryResponse
- FormatAllocation
- GeoCoordinates
- GetInventoryItem
- GetInventoryItemResponse
- Hazmat
- Interval
- InventoryItem
- InventoryItemGroup
- InventoryItemListing
- InventoryItemResponse
- InventoryItemWithSkuLocale
- InventoryItemWithSkuLocaleGroupKeys
- InventoryItemWithSkuLocaleGroupid
- InventoryItems
- InventoryLocation
- InventoryLocationFull
- InventoryLocationResponse
- ListingDetails
- ListingPolicies
- Location
- LocationDetails
- LocationResponse
- MigrateListing
- MigrateListingResponse
- NameValueList
- OfferKeyWithId
- OfferKeysWithId
- OfferPriceQuantity
- OfferResponse
- OfferResponseWithListingId
- OfferSkuResponse
- Offers
- OperatingHours
- PackageWeightAndSize
- PickupAtLocationAvailability
- PriceQuantity
- PriceQuantityResponse
- PricingSummary
- Product
- ProductFamilyProperties
- ProductIdentifier
- PublishByInventoryItemGroupRequest
- PublishResponse
- RegionalProductCompliancePolicies
- RegionalTakeBackPolicies
- Regulatory
- ShipToLocationAvailability
- ShipToLocationAvailabilityWithAll
- ShippingCostOverride
- SpecialHours
- Specification
- Tax
- TimeDuration
- VariesBy
- Version
- Weight
- WithdrawByInventoryItemGroupRequest
- WithdrawResponse
Documentation For Authorization
api_auth
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://auth.ebay.com/oauth2/authorize
- Scopes:
- https://api.ebay.com/oauth/api_scope/sell.inventory: View and manage your inventory and offers
- https://api.ebay.com/oauth/api_scope/sell.inventory.readonly: View your inventory and offers