Skip to content

Latest commit

 

History

History
228 lines (163 loc) · 24 KB

CustomPolicyApi.md

File metadata and controls

228 lines (163 loc) · 24 KB

SapientPro\EbayAccountSDK\Api\CustomPolicyApi

All URIs are relative to https://api.ebay.com/sell/account/v1

Method HTTP request Description
createCustomPolicy POST /custom_policy/
getCustomPolicies GET /custom_policy/
getCustomPolicy GET /custom_policy/{custom_policy_id}
updateCustomPolicy PUT /custom_policy/{custom_policy_id}

createCustomPolicy

createCustomPolicy(CustomPolicyCreateRequest $body, MarketplaceIdEnum $xEbayCMarketplaceId): void

This method creates a new custom policy in which a seller specifies their terms for complying with local governmental regulations.

Two Custom Policy types are supported:

  • Product Compliance (PRODUCT_COMPLIANCE)
  • Takeback (TAKE_BACK)
Each Custom Policy targets a policyType and eBay marketplace combination. Multiple policies may be created as follows:
  • Product Compliance: a maximum of 10 policies per eBay marketplace may be created
  • Takeback: a maximum of 3 policies per eBay marketplace may be created
A successful create policy call returns an HTTP status code of 201 Created with the system-generated policy ID included in the Location response header.

Product Compliance Policy

Product Compliance policies disclose product information as required for regulatory compliance.

<span class="tablenote">Note: A maximum of 10 Product Compliance policies per eBay marketplace may be created.

Takeback Policy

Takeback policies describe the seller's legal obligation to take back a previously purchased item when the buyer purchases a new one.

<span class="tablenote">Note: A maximum of 3 Takeback policies per eBay marketplace may be created.

Example

<?php
use SapientPro\EbayAccountSDK\Configuration;
use SapientPro\EbayAccountSDK\Api\CustomPolicyApi;
use SapientPro\EbayAccountSDK\Enums\MarketplaceIdEnum;

// Configure OAuth2 access token for authorization: api_auth
$config = Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new CustomPolicyApi(
    config: $config
);

$body = CustomPolicyCreateRequest::fromArray([
'description' => 'description_example',
'name' => 'name_example',
'label' => 'label_example',
'custom_policy_type_enum' => CustomPolicyTypeEnum::PRODUCT_COMPLIANCE,
]); 

try {
     $result = $apiInstance->createCustomPolicy($body, MarketplaceIdEnum::EBAY_US);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomPolicyApi->createCustomPolicy: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
body \SapientPro\EbayAccountSDK\Models\CustomPolicyCreateRequest Request to create a new Custom Policy.
xEbayCMarketplaceId \SapientPro\EbayAccountSDK\Enums\MarketplaceIdEnum This header parameter specifies the eBay markeplace for the custom policy that is being created. Supported values for this header can be found in the <a href=&quot;/api-docs/sell/account/types/ba:MarketplaceIdEnum&quot; target=&quot;_blank&quot;>MarketplaceIdEnum</a> type definition.<br/> <br/> <span class=&quot;tablenote&quot;><strong>Note:</strong> The following eBay marketplaces support Custom Policies: <ul><li>Germany (EBAY_DE)</li> <li>Canada (EBAY_CA)</li> <li>Australia (EBAY_AU)</li> <li>United States (EBAY_US)</li> <li>France (EBAY_FR)</li></ul></span>

Return type

void

Authorization

api_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getCustomPolicies

getCustomPolicies(MarketplaceIdEnum $xEbayCMarketplaceId, string $policy_types = null): CustomPolicyResponse

This method retrieves the list of custom policies specified by the policy_types query parameter for the selected eBay marketplace.

<span class="tablenote">Note: The following eBay marketplaces support Custom Policies:

  • Germany (EBAY_DE)
  • Canada (EBAY_CA)
  • Australia (EBAY_AU)
  • United States (EBAY_US)
  • France (EBAY_FR)


For details on header values, see <a href="/api-docs/static/rest-request-components.html#HTTP" target="_blank">HTTP request headers.

Example

<?php
use SapientPro\EbayAccountSDK\Configuration;
use SapientPro\EbayAccountSDK\Api\CustomPolicyApi;
use SapientPro\EbayAccountSDK\Enums\MarketplaceIdEnum;

// Configure OAuth2 access token for authorization: api_auth
$config = Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new CustomPolicyApi(
    config: $config
);

$policyTypes = "policy_types_example,example2"; // string | This query parameter specifies the type of custom policies to be returned.<br /><br />Multiple policy types may be requested in a single call by providing a comma-delimited set of all policy types to be returned.<br/><br/><span class=\"tablenote\"><strong>Note:</strong> Omitting this query parameter from a request will also return policies of all policy types.</span><br/><br/>Two Custom Policy types are supported: <ul><li>Product Compliance (PRODUCT_COMPLIANCE)</li> <li>Takeback (TAKE_BACK)</li></ul>

try {
    $result = $apiInstance->getCustomPolicies(MarketplaceIdEnum::EBAY_US, $policyTypes);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomPolicyApi->getCustomPolicies: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
xEbayCMarketplaceId MarketplaceIdEnum This header parameter specifies the eBay markeplace for the custom policy that is being created. Supported values for this header can be found in the <a href=&quot;/api-docs/sell/account/types/ba:MarketplaceIdEnum&quot; target=&quot;_blank&quot;>MarketplaceIdEnum</a> type definition.<br/> <br/> <span class=&quot;tablenote&quot;><strong>Note:</strong> The following eBay marketplaces support Custom Policies: <ul><li>Germany (EBAY_DE)</li> <li>Canada (EBAY_CA)</li> <li>Australia (EBAY_AU)</li> <li>United States (EBAY_US)</li> <li>France (EBAY_FR)</li></ul></span>
policyTypes string This query parameter specifies the type of custom policies to be returned.<br /><br />Multiple policy types may be requested in a single call by providing a comma-delimited set of all policy types to be returned.<br/><br/><span class=&quot;tablenote&quot;><strong>Note:</strong> Omitting this query parameter from a request will also return policies of all policy types.</span><br/><br/>Two Custom Policy types are supported: <ul><li>Product Compliance (PRODUCT_COMPLIANCE)</li> <li>Takeback (TAKE_BACK)</li></ul> [optional]

Return type

\SapientPro\EbayAccountSDK\Models\CustomPolicyResponse

Authorization

api_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getCustomPolicy

getCustomPolicy($customPolicyId, $xEbayCMarketplaceId): CustomPolicy

This method retrieves the custom policy specified by the custom_policy_id path parameter for the selected eBay marketplace.

<span class="tablenote">Note: The following eBay marketplaces support Custom Policies:

  • Germany (EBAY_DE)
  • Canada (EBAY_CA)
  • Australia (EBAY_AU)
  • United States (EBAY_US)
  • France (EBAY_FR)


For details on header values, see <a href="/api-docs/static/rest-request-components.html#HTTP" target="_blank">HTTP request headers.

Example

<?php
use SapientPro\EbayAccountSDK\Configuration;
use SapientPro\EbayAccountSDK\Api\CustomPolicyApi;
use SapientPro\EbayAccountSDK\Enums\MarketplaceIdEnum;

// Configure OAuth2 access token for authorization: api_auth
$config = Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new CustomPolicyApi(
    config: $config
);
$customPolicyId = "custom_policy_id_example"; // string | This path parameter is the unique custom policy identifier for the policy to be returned.<br/><br/><span class=\"tablenote\"><strong>Note:</strong> This value is automatically assigned by the system when the policy is created.</span>

try {
    $result = $apiInstance->getCustomPolicy($customPolicyId, $xEbayCMarketplaceId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomPolicyApi->getCustomPolicy: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
customPolicyId string This path parameter is the unique custom policy identifier for the policy to be returned.<br/><br/><span class=&quot;tablenote&quot;><strong>Note:</strong> This value is automatically assigned by the system when the policy is created.</span>
xEbayCMarketplaceId MarketplaceIdEnum This header parameter specifies the eBay markeplace for the custom policy that is being created. Supported values for this header can be found in the <a href=&quot;/api-docs/sell/account/types/ba:MarketplaceIdEnum&quot; target=&quot;_blank&quot;>MarketplaceIdEnum</a> type definition.<br/> <br/> <span class=&quot;tablenote&quot;><strong>Note:</strong> The following eBay marketplaces support Custom Policies: <ul><li>Germany (EBAY_DE)</li> <li>Canada (EBAY_CA)</li> <li>Australia (EBAY_AU)</li> <li>United States (EBAY_US)</li> <li>France (EBAY_FR)</li></ul></span>

Return type

\SapientPro\EbayAccountSDK\Models\CustomPolicy

Authorization

api_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateCustomPolicy

updateCustomPolicy($body, $xEbayCMarketplaceId, $customPolicyId): void

This method updates an existing custom policy specified by the custom_policy_id path parameter for the selected marketplace. This method overwrites the policy's Name, Label, and Description fields. Therefore, the complete, current text of all three policy fields must be included in the request payload even when one or two of these fields will not actually be updated.

For example, the value for the Label field is to be updated, but the Name and Description values will remain unchanged. The existing Name and Description values, as they are defined in the current policy, must also be passed in.

A successful policy update call returns an HTTP status code of 204 No Content.

<span class="tablenote">Note: The following eBay marketplaces support Custom Policies:

  • Germany (EBAY_DE)
  • Canada (EBAY_CA)
  • Australia (EBAY_AU)
  • United States (EBAY_US)
  • France (EBAY_FR)


For details on header values, see <a href="/api-docs/static/rest-request-components.html#HTTP">HTTP request headers.

Example

<?php
use SapientPro\EbayAccountSDK\Configuration;
use SapientPro\EbayAccountSDK\Api\CustomPolicyApi;
use SapientPro\EbayAccountSDK\Enums\MarketplaceIdEnum;
use SapientPro\EbayAccountSDK\Models\CustomPolicyRequest;

// Configure OAuth2 access token for authorization: api_auth
$config = Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = CustomPolicyApi(
    config: $config
);
$body = CustomPolicyRequest::fromArray([
'description' => 'description_example',
'name' => 'name_example',
'label' => 'label_example',
]);
$customPolicyId = "custom_policy_id_example"; // string | This path parameter is the unique custom policy identifier for the policy to be returned.<br/><br/><span class=\"tablenote\"><strong>Note:</strong> This value is automatically assigned by the system when the policy is created.</span>

try {
    $apiInstance->updateCustomPolicy($body, MarketplaceIdEnum::EBAY_US, $customPolicyId);
} catch (Exception $e) {
    echo 'Exception when calling CustomPolicyApi->updateCustomPolicy: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
body \SapientPro\EbayAccountSDK\ModelsCustomPolicyRequest Request to update a current custom policy.
xEbayCMarketplaceId MarketplaceIdEnum This header parameter specifies the eBay markeplace for the custom policy that is being created. Supported values for this header can be found in the <a href=&quot;/api-docs/sell/account/types/ba:MarketplaceIdEnum&quot; target=&quot;_blank&quot;>MarketplaceIdEnum</a> type definition.<br/> <br/> <span class=&quot;tablenote&quot;><strong>Note:</strong> The following eBay marketplaces support Custom Policies: <ul><li>Germany (EBAY_DE)</li> <li>Canada (EBAY_CA)</li> <li>Australia (EBAY_AU)</li> <li>United States (EBAY_US)</li> <li>France (EBAY_FR)</li></ul></span>
customPolicyId string This path parameter is the unique custom policy identifier for the policy to be returned.<br/><br/><span class=&quot;tablenote&quot;><strong>Note:</strong> This value is automatically assigned by the system when the policy is created.</span>

Return type

void (empty response body)

Authorization

api_auth

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]