nogrod / ebay-buy-browse-php-sdk
v0.1.1
2024-05-31 09:46 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.4.5
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- overtrue/phplint: ^9.0
- phpunit/phpunit: ^9.0
README
浏览API有以下资源
- item_summary
允许购物者通过关键词、GTIN、类别、慈善机构、产品、图像等搜索特定物品,- item
允许购物者检索特定物品或商品组的详细信息,商品组是一种具有颜色、尺寸等变体的商品,并检查产品是否与指定物品兼容,例如,检查特定车辆是否与特定零部件兼容。
此资源还提供了eBay传统API(如Finding)与RESTful API之间的桥梁,后者使用不同的格式表示商品ID。 - item
安装与使用
需求
PHP 8.1及更高版本。
Composer
要使用Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/nogrod/ebay-buy-browse-php-sdk.git"
}
],
"require": {
"nogrod/ebay-buy-browse-php-sdk": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
<?php require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
入门
请按照安装过程进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: api_auth $config = eBay\Buy\Browse\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new eBay\Buy\Browse\Api\ItemApi( // 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 ); $item_id = 'item_id_example'; // string | This path parameter specifies the unique RESTful identifier of an item (such as the park you want to check).<br><br><b>RESTful Item ID Format: </b><code>v1</code>|<code><i>#</i></code>|<code><i>#</i></code><br><br>For a single SKU listing, pass in the item ID: <pre>v1|2**********2|0</pre>For a multi-SKU listing, pass in the identifier of the variation:<pre>v1|1**********2|4**********2</pre><br>For more information about item IDs for RESTful APIs, refer to <a href=\"/api-docs/buy/static/api-browse.html#Legacy\" target=\"_blank\">Item ID legacy API compatibility overview</a> in the <a href=\"/api-docs/buy/static/buying-ig-landing.html\" target=\"_blank\">Buying Integration Guide</a>. $x_ebay_c_marketplace_id = 'x_ebay_c_marketplace_id_example'; // string | This header identifies the seller's eBay marketplace. It is required for all marketplaces outside of the US.<br><br><span class=\"tablenote\"><b>Note:</b> If a marketplace ID value is not provided, the default value of <code>EBAY_US</code> is used.</span><br>See <a href=\"/api-docs/buy/browse/types/ba:MarketplaceIdEnum\" target=\"_blank\">MarketplaceIdEnum</a> for supported values. $accept_language = 'accept_language_example'; // string | This header is used to indicate the natural language and locale preferred by the user for the response.<br><br>This header is required when targeting a specific locale of a marketplace that supports multiple locales. For example:<ul><li>When targeting the French locale of the Belgium marketplace, it is required to pass in <code>fr-BE</code> to specify this. If this locale is not specified, the language will default to Dutch.</li><li>When targeting the French locale of the Canadian marketplace, it is required to pass in <code>fr-CA</code> to specify this. If this locale is not specified, the language will default to English.</li></ul> $compatibility_payload = new \eBay\Buy\Browse\Model\CompatibilityPayload(); // \eBay\Buy\Browse\Model\CompatibilityPayload try { $result = $apiInstance->checkCompatibility($item_id, $x_ebay_c_marketplace_id, $accept_language, $compatibility_payload); print_r($result); } catch (Exception $e) { echo 'Exception when calling ItemApi->checkCompatibility: ', $e->getMessage(), PHP_EOL; }
API端点
所有URI均相对于https://api.ebay.com/buy/browse/v1
模型
- AdditionalProductIdentity
- AddonService
- Address
- Amount
- Aspect
- AspectDistribution
- AspectGroup
- AspectValueDistribution
- AttributeNameValue
- AuthenticityGuaranteeProgram
- AuthenticityVerificationProgram
- AutoCorrections
- AvailableCoupon
- BuyingOptionDistribution
- Category
- CategoryDistribution
- CommonDescriptions
- CompatibilityPayload
- CompatibilityProperty
- CompatibilityResponse
- ConditionDescriptor
- ConditionDescriptorValue
- ConditionDistribution
- ConvertedAmount
- CoreItem
- CouponConstraint
- EconomicOperator
- Error
- ErrorParameter
- EstimatedAvailability
- HazardPictogram
- HazardStatement
- HazardousMaterialsLabels
- Image
- Item
- ItemGroup
- ItemGroupSummary
- ItemLocationImpl
- ItemReturnTerms
- ItemSummary
- Items
- LegalAddress
- MarketingPrice
- PaymentMethod
- PaymentMethodBrand
- PickupOptionSummary
- Product
- ProductIdentity
- RatingHistogram
- Refinement
- Region
- ReviewRating
- SearchByImageRequest
- SearchPagedCollection
- Seller
- SellerCustomPolicy
- SellerDetail
- SellerLegalInfo
- ShipToLocation
- ShipToLocations
- ShipToRegion
- ShippingOption
- ShippingOptionSummary
- TargetLocation
- TaxJurisdiction
- Taxes
- TimeDuration
- TypedNameValue
- VatDetail
授权
api_auth
- 类型:
OAuth - 流程:
application - 授权URL: ``
- 作用域:
- https://api.ebay.com/oauth/api_scope/buy.item.bulk:批量检索eBay商品。
- https://api.ebay.com/oauth/api_scope:查看eBay的公开数据
测试
要运行测试,请使用
composer install vendor/bin/phpunit
作者
关于此包
此PHP包是由OpenAPI Generator项目自动生成的
- API版本:
v1.19.7- 包版本:
0.0.1 - 生成器版本:
7.6.0
- 包版本:
- 构建包:
org.openapitools.codegen.languages.PhpNextgenClientCodegen