{"id":262627,"date":"2020-08-09T14:09:16","date_gmt":"2020-08-09T14:09:16","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=262627"},"modified":"2021-12-30T09:36:45","modified_gmt":"2021-12-30T09:36:45","slug":"working-of-http-client-at-the-shopware","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/","title":{"rendered":"Working of HTTP client at the Shopware"},"content":{"rendered":"\n<p>In this blog, you are going to learn \u201cabout working with an HTTP client at the Shopware \u201d.<br>I hope you know the directory structure of&nbsp;<a href=\"https:\/\/webkul.com\/blog\/create-product-and-product-variant-in-shopware-6\/\">Shopware<\/a>&nbsp;6 plugin, if you don\u2019t know, see here-&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/webkul.com\/blog\/create-product-and-product-variant-in-shopware-6\/\" target=\"_blank\">https:\/\/docs.shopware.com\/en\/shopware-platform-dev-en\/internals\/directory-structure<\/a>.<\/p>\n\n\n\n<p>Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API.<br>Shopware 6 comes with a powerful REST-API. You can use this API by using a HTTP-Client, like curl or similar. For reasons of simplicity we wrote a Shopware 6 plugin, but in most cases this is not a good use case. Please do not call the Shopware 6 API through a plugin unless you do have a really good reason to do so!<\/p>\n\n\n\n<p>Let&#8217;s create a class that makes use of&nbsp;<a href=\"http:\/\/docs.guzzlephp.org\/\">Guzzle<\/a>, which is already included in the&nbsp;<code>shopware\/core<\/code>, so that we can add multiple helpful functions to this class and simplify the use of the API.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">RestService.php<\/h5>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php declare(strict_types=1);\n\nnamespace Webkul\\RestApiHandling\\Service;\n\nuse GuzzleHttp\\Client;\n\nclass RestService\n{\n    \/**\n     * @var Client\n     *\/\n    private $restClient;\n\n    public function __construct()\n    {\n        $this-&gt;restClient = new Client();\n    }\n}<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">service.xml<\/h5>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot; ?&gt;\n\n&lt;container xmlns=&quot;http:\/\/symfony.com\/schema\/dic\/services&quot;\n           xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\n           xsi:schemaLocation=&quot;http:\/\/symfony.com\/schema\/dic\/services http:\/\/symfony.com\/schema\/dic\/services\/services-1.0.xsd&quot;&gt;\n\n    &lt;services&gt;\n        &lt;service id=&quot;Webkul\\RestApiHandling\\Service\\RestService&quot; \/&gt;\n    &lt;\/services&gt;\n&lt;\/container&gt;<\/pre>\n\n\n\n<p>The Admin API is secured via&nbsp;<a href=\"https:\/\/de.wikipedia.org\/wiki\/OAuth\">OAuth authentication<\/a>, so we need some helpers to get the authentication token before we do any further requests. Therefore, we extend our&nbsp;<code>RestService<\/code>&nbsp;class to do this during the constructor.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php declare(strict_types=1);\n\nnamespace Webkul\\RestApiHandling\\Service;\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse Psr\\Http\\Message\\RequestInterface;\nuse Shopware\\Core\\System\\SystemConfig\\SystemConfigService;\n\nclass RestService\n{\n    \/**\n     * @var Client\n     *\/\n    private $restClient;\n\n    \/**\n     * @var SystemConfigService\n     *\/\n    private $config;\n\n    \/**\n     * @var string\n     *\/\n    private $accessToken;\n\n    \/**\n     * @var string\n     *\/\n    private $refreshToken;\n\n    \/**\n     * @var \\DateTimeInterface\n     *\/\n    private $expiresAt;\n\n    public function __construct(SystemConfigService $config)\n    {\n        $this-&gt;restClient = new Client();\n        $this-&gt;config = $config;\n    }\n\n    private function getAdminAccess(): void\n    {\n        $body = \\json_encode(&#091;\n            &#039;client_id&#039; =&gt; &#039;administration&#039;,\n            &#039;grant_type&#039; =&gt; &#039;password&#039;,\n            &#039;scopes&#039; =&gt; $this-&gt;config-&gt;get(&#039;RestApiHandling.config.scope&#039;),\n            &#039;username&#039; =&gt; $this-&gt;config-&gt;get(&#039;RestApiHandling.config.username&#039;),\n            &#039;password&#039; =&gt; $this-&gt;config-&gt;get(&#039;RestApiHandling.config.password&#039;)\n        ]);\n\n        $request = new Request(\n            &#039;POST&#039;,\n            getenv(&#039;APP_URL&#039;) . &#039;\/api\/oauth\/token&#039;,\n            &#091;&#039;Content-Type&#039; =&gt; &#039;application\/json&#039;],\n            $body\n        );\n\n        $response = $this-&gt;restClient-&gt;send($request);\n\n        $body = json_decode($response-&gt;getBody()-&gt;getContents(), true);\n\n        $this-&gt;setAccessData($body);\n    }\n\n    private function setAccessData(array $body): void\n    {\n        $this-&gt;accessToken = $body&#091;&#039;access_token&#039;];\n        $this-&gt;refreshToken = $body&#091;&#039;refresh_token&#039;];\n        $this-&gt;expiresAt = $this-&gt;calculateExpiryTime((int) $body&#091;&#039;expires_in&#039;]);\n    }\n\n    private function calculateExpiryTime(int $expiresIn): \\DateTimeInterface\n    {\n        $expiryTimestamp = (new \\DateTime())-&gt;getTimestamp() + $expiresIn;\n\n        return (new \\DateTimeImmutable())-&gt;setTimestamp($expiryTimestamp);\n    }\n\n    private function createShopwareApiRequest(string $method, string $uri, ?string $body = null): RequestInterface\n    {\n        return new Request(\n            $method,\n            getenv(&#039;APP_URL&#039;) . &#039;\/api\/v3\/&#039; . $uri,\n            &#091;\n                &#039;Authorization&#039; =&gt; &#039;Bearer &#039; . $this-&gt;accessToken,\n                &#039;Accept&#039; =&gt; &#039;*\/*&#039;\n            ],\n            $body\n        );\n    }\n}<\/pre>\n\n\n\n<p>Note our extension of the constructor! First we get the&nbsp;<code>SystemConfigService<\/code>&nbsp;to ask for information we can maintain in the&nbsp;<code>administration<\/code>.<\/p>\n\n\n\n<p>Since we have changed our&nbsp;<code>RestService<\/code>&nbsp;constructor we need to change our&nbsp;<code>services.xml<\/code>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot; ?&gt;\n\n&lt;container xmlns=&quot;http:\/\/symfony.com\/schema\/dic\/services&quot;\n           xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\n           xsi:schemaLocation=&quot;http:\/\/symfony.com\/schema\/dic\/services http:\/\/symfony.com\/schema\/dic\/services\/services-1.0.xsd&quot;&gt;\n\n    &lt;services&gt;\n        &lt;service id=&quot;Swag\\RestApiHandling\\Service\\RestService&quot;&gt;\n            &lt;argument type=&quot;service&quot; id=&quot;Shopware\\Core\\System\\SystemConfig\\SystemConfigService&quot;\/&gt;\n        &lt;\/service&gt;\n    &lt;\/services&gt;\n&lt;\/container&gt;<\/pre>\n\n\n\n<p>Now we need to add a&nbsp;<code>config.xml<\/code>&nbsp;to our plugin so that we can maintain the required data information in the administration.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">config.xml<\/h5>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\n        xsi:noNamespaceSchemaLocation=&quot;https:\/\/raw.githubusercontent.com\/shopware\/platform\/master\/src\/Core\/System\/SystemConfig\/Schema\/config.xsd&quot;&gt;\n\n    &lt;card&gt;\n        &lt;title&gt;User Data&lt;\/title&gt;\n        &lt;title lang=&quot;de-DE&quot;&gt;Benutzerdaten&lt;\/title&gt;\n        &lt;input-field&gt;\n            &lt;name&gt;username&lt;\/name&gt;\n            &lt;label&gt;Api user name&lt;\/label&gt;\n            &lt;label lang=&quot;de-DE&quot;&gt;API Benutzername&lt;\/label&gt;\n        &lt;\/input-field&gt;\n        &lt;input-field type=&quot;password&quot;&gt;\n            &lt;name&gt;password&lt;\/name&gt;\n            &lt;label&gt;Api user password&lt;\/label&gt;\n            &lt;label lang=&quot;de-DE&quot;&gt;API Benutzerpasswort&lt;\/label&gt;\n        &lt;\/input-field&gt;\n        &lt;input-field type=&quot;single-select&quot;&gt;\n            &lt;name&gt;scope&lt;\/name&gt;\n            &lt;label&gt;API access level&lt;\/label&gt;\n            &lt;label lang=&quot;de-DE&quot;&gt;API Zugriffslevel&lt;\/label&gt;\n            &lt;options&gt;\n                &lt;option&gt;\n                    &lt;id&gt;write&lt;\/id&gt;\n                    &lt;name&gt;Write-Access&lt;\/name&gt;\n                    &lt;name lang=&quot;de-DE&quot;&gt;Schreibzugriff&lt;\/name&gt;\n                &lt;\/option&gt;\n                &lt;option&gt;\n                    &lt;id&gt;read&lt;\/id&gt;\n                    &lt;name&gt;Read-Access&lt;\/name&gt;\n                    &lt;name lang=&quot;de-DE&quot;&gt;Lesezugriff&lt;\/name&gt;\n                &lt;\/option&gt;\n            &lt;\/options&gt;\n        &lt;\/input-field&gt;\n    &lt;\/card&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p>One of the problems that can occur when working with the Admin API is that your access token has expired. To avoid having to deal with this problem we have already included the refresh token and expiration time in our properties, so let&#8217;s start automatically generating a new access token.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nclass RestService\n{\n    ...\n\n    private function send(RequestInterface $request, string $uri)\n    {\n        if ($this-&gt;expiresAt &lt;= (new \\DateTime())) {\n            $this-&gt;refreshAuthToken();\n\n            $body = $request-&gt;getBody()-&gt;getContents();\n\n            $request = $this-&gt;createShopwareApiRequest($request-&gt;getMethod(), $uri, $body);\n        }\n\n        return $this-&gt;restClient-&gt;send($request);\n    }\n\n    private function refreshAuthToken(): void\n    {\n        $body = \\json_encode(&#091;\n            &#039;client_id&#039; =&gt; &#039;administration&#039;,\n            &#039;grant_type&#039; =&gt; &#039;refresh_token&#039;,\n            &#039;scopes&#039; =&gt; $this-&gt;config-&gt;get(&#039;RestApiHandling.config.scope&#039;),\n            &#039;refresh_token&#039; =&gt; $this-&gt;refreshToken\n        ]);\n\n        $request = new Request(\n            &#039;POST&#039;,\n            getenv(&#039;APP_URL&#039;) . &#039;\/api\/oauth\/token&#039;,\n            &#091;&#039;Content-Type&#039; =&gt; &#039;application\/json&#039;],\n            $body\n        );\n\n        $response = $this-&gt;restClient-&gt;send($request);\n\n        $body = json_decode($response-&gt;getBody()-&gt;getContents(), true);\n\n        $this-&gt;setAccessData($body);\n    }\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php \n\nuse Psr\\Http\\Message\\ResponseInterface;\n\nclass RestService\n{\n    ...\n\n    public function request(string $method, string $uri, ?array $body = null): ResponseInterface\n    {\n        if ($this-&gt;accessToken === null || $this-&gt;refreshToken === null || $this-&gt;expiresAt === null) {\n            $this-&gt;getAdminAccess();\n        }\n\n        $bodyEncoded = json_encode($body);\n\n        $request = $this-&gt;createShopwareApiRequest($method, $uri, $bodyEncoded);\n\n        return $this-&gt;send($request, $uri);\n    }\n}<\/pre>\n\n\n\n<p>The&nbsp;<code>request<\/code>&nbsp;function makes it easy to send API requests. It requests the API credentials if they do not already exist, and converts your request into a Admin API request.&nbsp;<br>$this-&gt;restService-&gt;request(&#8216;GET&#8217;, &#8216;product&#8217;);<\/p>\n\n\n\n<p>The first parameter is the HTTP method to be used.<\/p>\n\n\n\n<p>The second parameter is the route \/ entity name you want to call. Some examples would be&nbsp;<code>product<\/code>,&nbsp;<code>rule<\/code>&nbsp;or&nbsp;<code>language<\/code>.<\/p>\n\n\n\n<p>The third parameter is the data you might want to send to the API. These data can be written as an&nbsp;<code>array<\/code>&nbsp;and is encoded by PHP according to the JSON scheme.<\/p>\n\n\n\n<p>I hope it will help you. Thanks for reading. Happy Coding \ud83d\ude42<br>Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, you are going to learn \u201cabout working with an HTTP client at the Shopware \u201d.I hope you know the directory structure of&nbsp;Shopware&nbsp;6 plugin, if you don\u2019t know, see here-&nbsp;https:\/\/docs.shopware.com\/en\/shopware-platform-dev-en\/internals\/directory-structure. Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API.Shopware 6 comes with a powerful <a href=\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":284,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-262627","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Working of HTTP client at the Shopware - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working of HTTP client at the Shopware - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-09T14:09:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-30T09:36:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Diwakar Rana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Diwakar Rana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\"},\"author\":{\"name\":\"Diwakar Rana\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/4b025fe4ecbc5c0378cd13bb70da654f\"},\"headline\":\"Working of HTTP client at the Shopware\",\"datePublished\":\"2020-08-09T14:09:16+00:00\",\"dateModified\":\"2021-12-30T09:36:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\"},\"wordCount\":433,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\",\"url\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\",\"name\":\"Working of HTTP client at the Shopware - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2020-08-09T14:09:16+00:00\",\"dateModified\":\"2021-12-30T09:36:45+00:00\",\"description\":\"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Working of HTTP client at the Shopware\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/4b025fe4ecbc5c0378cd13bb70da654f\",\"name\":\"Diwakar Rana\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/46482d0264c191ccd0337892016340a80ca4e4987a37f42514a0506aaee7e8dc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/46482d0264c191ccd0337892016340a80ca4e4987a37f42514a0506aaee7e8dc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Diwakar Rana\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/diwakar-rana829\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Working of HTTP client at the Shopware - Webkul Blog","description":"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/","og_locale":"en_US","og_type":"article","og_title":"Working of HTTP client at the Shopware - Webkul Blog","og_description":"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.","og_url":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2020-08-09T14:09:16+00:00","article_modified_time":"2021-12-30T09:36:45+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Diwakar Rana","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Diwakar Rana","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/"},"author":{"name":"Diwakar Rana","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/4b025fe4ecbc5c0378cd13bb70da654f"},"headline":"Working of HTTP client at the Shopware","datePublished":"2020-08-09T14:09:16+00:00","dateModified":"2021-12-30T09:36:45+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/"},"wordCount":433,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/","url":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/","name":"Working of HTTP client at the Shopware - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2020-08-09T14:09:16+00:00","dateModified":"2021-12-30T09:36:45+00:00","description":"Some things are not easy to solve without an API. For these cases Shopware 6 has a REST-API. Shopware 6 comes with a powerful REST-API.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/working-of-http-client-at-the-shopware\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Working of HTTP client at the Shopware"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/4b025fe4ecbc5c0378cd13bb70da654f","name":"Diwakar Rana","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/46482d0264c191ccd0337892016340a80ca4e4987a37f42514a0506aaee7e8dc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/46482d0264c191ccd0337892016340a80ca4e4987a37f42514a0506aaee7e8dc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Diwakar Rana"},"url":"https:\/\/webkul.com\/blog\/author\/diwakar-rana829\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/262627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/284"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=262627"}],"version-history":[{"count":7,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/262627\/revisions"}],"predecessor-version":[{"id":318228,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/262627\/revisions\/318228"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=262627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=262627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=262627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}