|
| 1 | +# Hostinger\EcommerceProductsApi |
| 2 | + |
| 3 | +All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path. |
| 4 | + |
| 5 | +| Method | HTTP request | Description | |
| 6 | +| ------------- | ------------- | ------------- | |
| 7 | +| [**createDigitalProductV1()**](EcommerceProductsApi.md#createDigitalProductV1) | **POST** /api/ecommerce/v1/stores/{store_id}/products/digital | Create digital product | |
| 8 | +| [**createPhysicalProductV1()**](EcommerceProductsApi.md#createPhysicalProductV1) | **POST** /api/ecommerce/v1/stores/{store_id}/products/physical | Create physical product | |
| 9 | + |
| 10 | + |
| 11 | +## `createDigitalProductV1()` |
| 12 | + |
| 13 | +```php |
| 14 | +createDigitalProductV1($storeId, $ecommerceV1ProductCreateDigitalProductRequest): \Hostinger\Model\EcommerceV1ProductProductCreationResource |
| 15 | +``` |
| 16 | + |
| 17 | +Create digital product |
| 18 | + |
| 19 | +Create a published digital product with a single variant and an optional external download link. |
| 20 | + |
| 21 | +### Example |
| 22 | + |
| 23 | +```php |
| 24 | +<?php |
| 25 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 26 | + |
| 27 | + |
| 28 | +// Configure Bearer authorization: apiToken |
| 29 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 30 | + |
| 31 | + |
| 32 | +$apiInstance = new Hostinger\Api\EcommerceProductsApi(config: $config); |
| 33 | +$storeId = store_01J8Z5F8W9K8M4A7B3C2D1E0FG; // string | The ID of the store to create the product in. |
| 34 | +$ecommerceV1ProductCreateDigitalProductRequest = new \Hostinger\Model\EcommerceV1ProductCreateDigitalProductRequest(); // \Hostinger\Model\EcommerceV1ProductCreateDigitalProductRequest |
| 35 | + |
| 36 | +try { |
| 37 | + $result = $apiInstance->createDigitalProductV1($storeId, $ecommerceV1ProductCreateDigitalProductRequest); |
| 38 | + print_r($result); |
| 39 | +} catch (Exception $e) { |
| 40 | + echo 'Exception when calling EcommerceProductsApi->createDigitalProductV1: ', $e->getMessage(), PHP_EOL; |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +### Parameters |
| 45 | + |
| 46 | +| Name | Type | Description | Notes | |
| 47 | +| ------------- | ------------- | ------------- | ------------- | |
| 48 | +| **storeId** | **string**| The ID of the store to create the product in. | | |
| 49 | +| **ecommerceV1ProductCreateDigitalProductRequest** | [**\Hostinger\Model\EcommerceV1ProductCreateDigitalProductRequest**](../Model/EcommerceV1ProductCreateDigitalProductRequest.md)| | | |
| 50 | + |
| 51 | +### Return type |
| 52 | + |
| 53 | +[**\Hostinger\Model\EcommerceV1ProductProductCreationResource**](../Model/EcommerceV1ProductProductCreationResource.md) |
| 54 | + |
| 55 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 56 | +[[Back to Model list]](../../README.md#models) |
| 57 | +[[Back to README]](../../README.md) |
| 58 | + |
| 59 | +## `createPhysicalProductV1()` |
| 60 | + |
| 61 | +```php |
| 62 | +createPhysicalProductV1($storeId, $ecommerceV1ProductCreatePhysicalProductRequest): \Hostinger\Model\EcommerceV1ProductProductCreationResource |
| 63 | +``` |
| 64 | + |
| 65 | +Create physical product |
| 66 | + |
| 67 | +Create a published physical product with a single variant priced in the store currency. |
| 68 | + |
| 69 | +### Example |
| 70 | + |
| 71 | +```php |
| 72 | +<?php |
| 73 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 74 | + |
| 75 | + |
| 76 | +// Configure Bearer authorization: apiToken |
| 77 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 78 | + |
| 79 | + |
| 80 | +$apiInstance = new Hostinger\Api\EcommerceProductsApi(config: $config); |
| 81 | +$storeId = store_01J8Z5F8W9K8M4A7B3C2D1E0FG; // string | The ID of the store to create the product in. |
| 82 | +$ecommerceV1ProductCreatePhysicalProductRequest = new \Hostinger\Model\EcommerceV1ProductCreatePhysicalProductRequest(); // \Hostinger\Model\EcommerceV1ProductCreatePhysicalProductRequest |
| 83 | + |
| 84 | +try { |
| 85 | + $result = $apiInstance->createPhysicalProductV1($storeId, $ecommerceV1ProductCreatePhysicalProductRequest); |
| 86 | + print_r($result); |
| 87 | +} catch (Exception $e) { |
| 88 | + echo 'Exception when calling EcommerceProductsApi->createPhysicalProductV1: ', $e->getMessage(), PHP_EOL; |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +### Parameters |
| 93 | + |
| 94 | +| Name | Type | Description | Notes | |
| 95 | +| ------------- | ------------- | ------------- | ------------- | |
| 96 | +| **storeId** | **string**| The ID of the store to create the product in. | | |
| 97 | +| **ecommerceV1ProductCreatePhysicalProductRequest** | [**\Hostinger\Model\EcommerceV1ProductCreatePhysicalProductRequest**](../Model/EcommerceV1ProductCreatePhysicalProductRequest.md)| | | |
| 98 | + |
| 99 | +### Return type |
| 100 | + |
| 101 | +[**\Hostinger\Model\EcommerceV1ProductProductCreationResource**](../Model/EcommerceV1ProductProductCreationResource.md) |
| 102 | + |
| 103 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 104 | +[[Back to Model list]](../../README.md#models) |
| 105 | +[[Back to README]](../../README.md) |
0 commit comments