1. Go to this page and download the library: Download omnismith-sdk/php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omnismith-sdk / php example snippets
uzzleHttp\Client;
use Omnismith\Sdk\Api\EntityApi;
use Omnismith\Sdk\Api\TemplatesApi;
use Omnismith\Sdk\Configuration;
use Omnismith\Sdk\Model\CreateEntityRequest;
$configuration = Configuration::getDefaultConfiguration()
->setHost('https://api.omnismith.io/v1')
->setAccessToken(getenv('OMNISMITH_ACCESS_TOKEN'));
$httpClient = new Client();
$templatesApi = new TemplatesApi($httpClient, $configuration);
$entityApi = new EntityApi($httpClient, $configuration);
$templateId = 'your-template-id';
$template = $templatesApi->getTemplate($templateId);
$entity = $entityApi->createEntity(
new CreateEntityRequest([
'template_id' => $template->getId(),
'attribute_values' => [
[
'attribute_id' => $template->getAttributeIds()[0],
'value' => 'SKU-1001',
],
],
])
);
printf("%s %s\n", $template->getName(), $entity->getId());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.