{"id":27951,"date":"2022-08-17T07:38:49","date_gmt":"2022-08-17T07:38:49","guid":{"rendered":"http:\/\/fetch-and-update-any-company-logo-in-gatsby"},"modified":"2022-08-17T07:38:49","modified_gmt":"2022-08-17T07:38:49","slug":"fetch-and-update-any-company-logo-in-gatsby","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/","title":{"rendered":"Fetch and Update any Company Logo in Gatsby"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><h1>Introduction<\/h1>\n<p>Fetching data in Gatsby has been made easy using Gatsby Functions. Gatsby Functions enable us to build Express-like backends without running any servers.<\/p>\n<p>In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.<\/p>\n<h1>Sandbox<\/h1>\n<p>The completed project is on <a href=\"https:\/\/codesandbox.io\/s\/automatically-fetch-and-update-any-company-logo-in-gatsbyjs-nsuefj\">CodeSandbox<\/a>. Fork it and run the code.<\/p>\n<\/div>\n  \n  <div class=\"wp-block-cloudinary-code-sandbox \">\n    <iframe\n      src=\"https:\/\/codesandbox.io\/embed\/automatically-fetch-and-update-any-company-logo-in-gatsbyjs-nsuefj?theme=dark&amp;codemirror=1&amp;highlights=&amp;editorsize=50&amp;fontsize=14&amp;expanddevtools=0&amp;hidedevtools=0&amp;eslint=0&amp;forcerefresh=0&amp;hidenavigation=0&amp;initialpath=%2F&amp;module=&amp;moduleview=0&amp;previewwindow=&amp;view=&amp;runonclick=1\"\n      height=\"500\"\n      style=\"width: 100%;\"\n      title=\"Automatically fetch and update any company logo in GatsbyJS\"\n      loading=\"lazy\"\n      allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\"\n      sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n    ><\/iframe>\n  <\/div>\n\n  <div class=\"wp-block-cloudinary-markdown \"><h1>GitHub repository<\/h1>\n<p><a href=\"https:\/\/github.com\/folucode\/fetch-company-logos-gatsbyjs\">https:\/\/github.com\/folucode\/fetch-company-logos-gatsbyjs<\/a><\/p>\n<h1>Prerequisites<\/h1>\n<p>To follow along with this article, you\u2019ll need to have:<\/p>\n<ul>\n<li>An understanding of JavaScript and Gatsby<\/li>\n<\/ul>\n<h1>Project setup<\/h1>\n<p><a href=\"https:\/\/nodejs.org\/en\/\">Node<\/a> and its package manager <a href=\"https:\/\/www.npmjs.com\/\">npm<\/a> are required to initialize a new project.<\/p>\n<p>To install Node, go to the <a href=\"https:\/\/nodejs.org\/en\/\">Nodejs website<\/a> and follow the instructions. Then, verify its installation using the terminal command below:<\/p>\n<pre><code>node -v\nv16.10.0 \/\/node version installed\n<\/code><\/pre>\n<p>The result shows the version of Node.js we installed on our computer.<\/p>\n<h1>Create a Gatsby project<\/h1>\n<p>We\u2019ll create a new Gatsby application using the code below. This will create a new boilerplate app using Gatsby\u2019s default starter template.<\/p>\n<pre><code>$ gatsby new {project-name}\n<\/code><\/pre>\n<p>After successful installation, navigate into the app directly, like so:<\/p>\n<pre><code>$ cd {project-name}\n<\/code><\/pre>\n<p>Inside the new app directory, start the app using the code below. This will create a development server on <a href=\"http:\/\/localhost:8000\/\">http:\/\/localhost:8000\/<\/a>.<\/p>\n<pre><code>$ gatsby develop\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_7D191373A90C7E87CB2FB96787DB99F8AA328494F213C63E5B4DFC94EC4E12A5_1658429903992_Screenshot+2022-07-21+at+18.32.09.png\" alt=\"\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1250\"\/><\/p>\n<h1>Creating the application<\/h1>\n<p>First, let\u2019s do a basic setup. Create a new folder in the <code>src<\/code> folder called <code>styles<\/code>, and in it, create a new file called <code>index.css<\/code>. Paste the code below into that file:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\">    <span class=\"hljs-selector-class\">.column<\/span> {\n      <span class=\"hljs-attribute\">float<\/span>: left;\n      <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">33.33%<\/span>;\n      <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">5px<\/span>;\n    }\n    <span class=\"hljs-comment\">\/* Clear floats after image containers *\/<\/span>\n    <span class=\"hljs-selector-class\">.row<\/span><span class=\"hljs-selector-pseudo\">::after<\/span> {\n      <span class=\"hljs-attribute\">content<\/span>: <span class=\"hljs-string\">\"\"<\/span>;\n      <span class=\"hljs-attribute\">clear<\/span>: both;\n      <span class=\"hljs-attribute\">display<\/span>: table;\n    }\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Next, in the <code>index.js<\/code> file in the <code>page``s<\/code> folder, replace the boilerplate code with the code below:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> React, { useState, useEffect } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>\n    <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"..\/styles\/index.css\"<\/span>\n    \n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n      <span class=\"hljs-keyword\">return<\/span> (\n        <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"row\"<\/span>&gt;<\/span>\n          \n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n      )\n    }\n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> App\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<h2>Setting up Gatsby Function<\/h2>\n<p>To fetch the company logos, we\u2019ll need an API that can give us that information, and for this article, we\u2019ll be using <a href=\"https:\/\/brandfetch.com\/developers\">brandfetch<\/a>. Create an account by going to <a href=\"https:\/\/brandfetch.com\/developers\">brandfetch<\/a> and then clicking on the <strong>Get API Key<\/strong> button at the top right corner of the screen.<\/p>\n<p>Now, we\u2019ll need to store the API key in an <code>env<\/code> file for security reasons. To use <code>env<\/code> files in our <code>logo.js<\/code> file, we first need to create a <code>.env.development<\/code> file at the root of our project and enter our API key like so:<\/p>\n<pre><code>API_KEY=&lt;API-KEY&gt;\n<\/code><\/pre>\n<p>Then, in the <code>gatsby-config.js<\/code> file, paste the code below at the top of the file before any other syntax.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">\"dotenv\"<\/span>).config({\n      <span class=\"hljs-attr\">path<\/span>: <span class=\"hljs-string\">`.env.<span class=\"hljs-subst\">${process.env.NODE_ENV}<\/span>`<\/span>,\n    })\n    \n    <span class=\"hljs-built_in\">module<\/span>.exports = {\n    ...\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><strong>Note:<\/strong> Be sure to restart the development server after this process.<\/p>\n<p>After that, in the <code>src<\/code> folder, we\u2019ll create an <code>api<\/code> folder with a <code>logo.js<\/code> file inside it. Open the newly created <code>logo.js<\/code> file and paste the code below.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> fetch <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"node-fetch\"<\/span>\n    \n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">fetchLogos<\/span>(<span class=\"hljs-params\">req, res<\/span>) <\/span>{\n      <span class=\"hljs-keyword\">const<\/span> url = <span class=\"hljs-string\">\"https:\/\/api.brandfetch.io\/v2\/brands\"<\/span>\n      <span class=\"hljs-keyword\">const<\/span> headers = {\n        <span class=\"hljs-string\">\"Content-Type\"<\/span>: <span class=\"hljs-string\">\"application\/json\"<\/span>,\n        <span class=\"hljs-attr\">Authorization<\/span>: <span class=\"hljs-string\">`Bearer <span class=\"hljs-subst\">${process.env.API_KEY}<\/span>`<\/span>,\n      }\n    \n      <span class=\"hljs-keyword\">const<\/span> companies = &#91;<span class=\"hljs-string\">\"facebook\"<\/span>, <span class=\"hljs-string\">\"twitter\"<\/span>, <span class=\"hljs-string\">\"amazon\"<\/span>]\n    \n      <span class=\"hljs-keyword\">try<\/span> {\n        <span class=\"hljs-keyword\">let<\/span> logos = <span class=\"hljs-keyword\">await<\/span> <span class=\"hljs-built_in\">Promise<\/span>.all(\n          companies.map(<span class=\"hljs-keyword\">async<\/span> company =&gt; {\n            <span class=\"hljs-keyword\">const<\/span> result = <span class=\"hljs-keyword\">await<\/span> fetch(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${url}<\/span>\/<span class=\"hljs-subst\">${company}<\/span>.com`<\/span>, {\n              <span class=\"hljs-attr\">method<\/span>: <span class=\"hljs-string\">\"GET\"<\/span>,\n              <span class=\"hljs-attr\">headers<\/span>: headers,\n            }).then(<span class=\"hljs-function\"><span class=\"hljs-params\">res<\/span> =&gt;<\/span> {\n              <span class=\"hljs-keyword\">return<\/span> res.json()\n            })\n            <span class=\"hljs-keyword\">return<\/span> result.logos&#91;<span class=\"hljs-number\">0<\/span>].formats&#91;<span class=\"hljs-number\">1<\/span>].src\n          })\n        )\n    \n        res.json(logos)\n      } <span class=\"hljs-keyword\">catch<\/span> (error) {\n        res.status(<span class=\"hljs-number\">500<\/span>).send(error)\n      }\n    }\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>We are taking these steps in this file:<\/p>\n<ol>\n<li>Import fetch from node-fetch to query the <a href=\"https:\/\/brandfetch.com\/developers\">brandfetch<\/a> API endpoint. After that, we export a single function that accepts two parameters: req (Node\u2019s request object) and res (Node\u2019s response object).<\/li>\n<li>Set the <code>brandfetch<\/code> API base URL in a variable, and then set the necessary headers. The <strong>Authorization<\/strong> header is needed to authenticate the API. Put the names of the companies we want to show in an array.<\/li>\n<\/ol>\n<p><strong>Note:<\/strong> The API key can be found on the <a href=\"https:\/\/developers.brandfetch.com\/\">dashboard<\/a>.<\/p>\n<ol start=\"3\">\n<li>Map through our array of companies and obtain their data using the fetch API. After looping, we\u2019ll send the result using Node\u2019s response object.<\/li>\n<\/ol>\n<h2>Displaying the result<\/h2>\n<p>Now, in the <code>index.js<\/code> file in the <code>page``s<\/code> folder, we\u2019ll query our logo endpoint in a useEffect hook to get the data once our page loads. After that, save the response in the state.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> React, { useState, useEffect } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>\n    <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"..\/styles\/index.css\"<\/span>\n    \n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n      <span class=\"hljs-keyword\">const<\/span> &#91;data, setData] = useState(&#91;])\n    \n      useEffect(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n        <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">fetchData<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n          <span class=\"hljs-keyword\">const<\/span> result = <span class=\"hljs-keyword\">await<\/span> fetch(<span class=\"hljs-string\">`\/api\/logo`<\/span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">res<\/span> =&gt;<\/span> res.json())\n          setData(result)\n        }\n        fetchData()\n      }, &#91;])\n    \n      <span class=\"hljs-keyword\">return<\/span> (\n      ...\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Next, we display the results on our page once we have them in our state variable, like so:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">      ...\n      return (\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"row\"<\/span>&gt;<\/span>\n          {data.length &gt; 0\n            ? data.map(logo =&gt; (\n                <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"column\"<\/span> <span class=\"hljs-attr\">key<\/span>=<span class=\"hljs-string\">{logo}<\/span>&gt;<\/span>\n                  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{logo}<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">{logo}<\/span> <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">\"50%\"<\/span> <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">\"50%\"<\/span>\/&gt;<\/span>\n                <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n              ))\n            : \"\"}\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      )\n    ...\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>The result looks like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_7D191373A90C7E87CB2FB96787DB99F8AA328494F213C63E5B4DFC94EC4E12A5_1658429884706_Screenshot+2022-07-21+at+19.55.11.png\" alt=\"\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1250\"\/><\/p>\n<h1>Conclusion<\/h1>\n<p>This article taught us how to use Gatsby Functions to fetch data and render them.<\/p>\n<h1>Resources<\/h1>\n<ul>\n<li>\n<a href=\"https:\/\/www.gatsbyjs.com\/docs\">Gatsby Documentation<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/www.gatsbyjs.com\/docs\/reference\/functions\/getting-started\/\">Gatsby Functions Documentation<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/docs.brandfetch.com\/#e2e11a14-c3d6-413e-8dc1-5b6c05dea1a3\">BrandFetch Documentation<\/a>\n<\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":27952,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[381,332,395,134,177,380,371],"class_list":["post-27951","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-imagecdn","tag-api","tag-gatsby","tag-guest-post","tag-javascript","tag-serverless","tag-under-review"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Fetch and Update any Company Logo in Gatsby<\/title>\n<meta name=\"description\" content=\"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fetch and Update any Company Logo in Gatsby\" \/>\n<meta property=\"og:description\" content=\"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-17T07:38:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Fetch and Update any Company Logo in Gatsby\",\"datePublished\":\"2022-08-17T07:38:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\"},\"wordCount\":8,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA\",\"keywords\":[\"(Image)CDN\",\"API\",\"Gatsby\",\"Guest Post\",\"Javascript\",\"Serverless\",\"Under Review\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\",\"url\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\",\"name\":\"Fetch and Update any Company Logo in Gatsby\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA\",\"datePublished\":\"2022-08-17T07:38:49+00:00\",\"description\":\"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA\",\"width\":2560,\"height\":1440},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fetch and Update any Company Logo in Gatsby\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Fetch and Update any Company Logo in Gatsby","description":"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.","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:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/","og_locale":"en_US","og_type":"article","og_title":"Fetch and Update any Company Logo in Gatsby","og_description":"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.","og_url":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/","og_site_name":"Cloudinary Blog","article_published_time":"2022-08-17T07:38:49+00:00","og_image":[{"width":2560,"height":1440,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","type":"image\/png"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/"},"author":{"name":"","@id":""},"headline":"Fetch and Update any Company Logo in Gatsby","datePublished":"2022-08-17T07:38:49+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/"},"wordCount":8,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","keywords":["(Image)CDN","API","Gatsby","Guest Post","Javascript","Serverless","Under Review"],"inLanguage":"en-US","copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/","url":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/","name":"Fetch and Update any Company Logo in Gatsby","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","datePublished":"2022-08-17T07:38:49+00:00","description":"In this article, we\u2019ll learn how to use Gatsby Functions to make API calls and get a response in our Gatsby App.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","width":2560,"height":1440},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/fetch-and-update-any-company-logo-in-gatsby\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Fetch and Update any Company Logo in Gatsby"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681922341\/Web_Assets\/blog\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5\/1320f0c3c581cb1642792e3f556ac31d65d612d8-2560x1440-1_2795223cd5.png?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=27951"}],"version-history":[{"count":0,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27951\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/27952"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=27951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=27951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=27951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}