doPostRequest example

/** * @param string $shopwareId * @param string $password * * @throws Exception * * @return AccessTokenStruct */
    public function getAccessToken($shopwareId$password)
    {
        $response = $this->doPostRequest(
            '/accesstokens',
            [
                'shopwareId' => $shopwareId,
                'password' => $password,
            ]
        );

        return $this->structHydrator->hydrateAccessToken($response$shopwareId);
    }

    /** * @param string $resource * @param array<string, mixed> $params * @param array<string, string> $headers * * @throws Exception * * @return array<string, mixed> */

    public function registerAccount($shopwareId$email$password$localeId)
    {
        $postData = [
            'shopwareId' => $shopwareId,
            'email' => $email,
            'password' => $password,
            'localeId' => $localeId,
        ];

        try {
            return $this->storeClient->doPostRequest('/users', $postData);
        } catch (StoreException $se) {
            throw $this->translateExceptionMessage($se);
        }
    }

    /** * Gets a list of locales supported by the SBP * * @throws Exception * * @return LocaleStruct[] array of locale details */
$secret = $this->getShopSecret();

        $domain = $this->getDomain();
        $params = [
            'domain' => $domain,
            'shopwareVersion' => $this->release->getVersion(),
            'plugins' => $this->getPluginsNameAndVersion(),
        ];

        $header = $secret ? ['X-Shopware-Shop-Secret' => $secret] : [];

        $data = $this->storeClient->doPostRequest(
            '/pluginStore/environmentInformation',
            $params,
            $header
        );

        $isShopUpgraded = $data['general']['isUpgraded'];
        $pluginInformationStructs = array_map(
            function D$plugin) {
                return new PluginInformationStruct($plugin);
            },
            $data['plugins']
        );
Home | Imprint | This part of the site doesn't use cookies.