{"id":327,"date":"2025-03-13T10:57:58","date_gmt":"2025-03-13T10:57:58","guid":{"rendered":"https:\/\/documentation.iqonic.design\/graphina\/?p=327"},"modified":"2025-03-18T10:52:26","modified_gmt":"2025-03-18T10:52:26","slug":"how-to-fetch-dynamic-data-for-wordpress-charts-using-an-api","status":"publish","type":"post","link":"https:\/\/documentation.iqonic.design\/graphina\/how-to-fetch-dynamic-data-for-wordpress-charts-using-an-api\/","title":{"rendered":"How to Fetch Dynamic Data for WordPress Charts Using an API"},"content":{"rendered":"<div class=\"nolwrap\">\n<h4 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h4>\n\n\n\n<p>If you\u2019ve been following my blog, you know how much I love creating <strong>data visualization charts<\/strong> in WordPress. But what if you could <strong>fetch live data<\/strong> from an API without writing a single line of code?<\/p>\n\n\n\n<p>In this guide, we\u2019ll learn how to convert a <strong>static chart<\/strong> into a <strong>fully dynamic chart<\/strong> using an <strong>API<\/strong> as a data source.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"730\" src=\"https:\/\/documentation.iqonic.design\/graphina\/wp-content\/uploads\/sites\/3\/2025\/03\/image-8.png\" alt=\"\" class=\"wp-image-329\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Integrate an API with WordPress Charts<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1 \u2013 Select a Chart<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open <strong>Graphina \u2013 WordPress Chart Plugin<\/strong>.<\/li>\n\n\n\n<li>Choose the chart where you want to display <strong>live API data<\/strong>.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2 \u2013 Change Data Source to Dynamic<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the <strong>chart data settings<\/strong>, switch the source from <strong>\u201cManual\u201d<\/strong> to <strong>\u201cDynamic\u201d<\/strong>.<\/li>\n\n\n\n<li>If you see a <strong>\u201cNo Data Available\u201d<\/strong> message, don\u2019t worry\u2014it just means the data source isn\u2019t connected yet.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3 \u2013 Connect an API<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the <strong>Dynamic Data Options<\/strong>, select <strong>\u201cAPI\u201d<\/strong> as the data source.<\/li>\n\n\n\n<li>A <strong>URL input box<\/strong> will appear.<\/li>\n\n\n\n<li>Copy the <strong>API endpoint URL<\/strong> and paste it into the input box.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 4 \u2013 Handling API Authorization (Header Keys &amp; Tokens)<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some APIs require an <strong>API key<\/strong> or <strong>authentication token<\/strong> for access.<\/li>\n\n\n\n<li>In the API settings, enter the required <strong>header key<\/strong> and <strong>header token,<\/strong> if applicable.<\/li>\n\n\n\n<li>This ensures secure and authenticated access to external data sources.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 5 \u2013 Adjust Data Elements<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the <strong>chart data settings<\/strong>, increase the <strong>data elements<\/strong> to match the API response.<\/li>\n\n\n\n<li>The chart will <strong>update automatically<\/strong>, reflecting the <strong>latest data<\/strong> from the API.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Benefits of Using an API for WordPress Charts<\/strong><\/h3>\n\n\n\n<p>\u2705 <strong>Live Data Integration<\/strong> \u2013 Fetch real-time data without manual updates.<br>\u2705 <strong>Seamless API Authentication<\/strong> \u2013 Use API keys and tokens for secure data access.<br>\u2705 <strong>Instant Updates<\/strong> \u2013 Charts auto-refresh as new API data becomes available.<\/p>\n\n\n\n<p>With these simple steps, you can easily integrate <strong>live API data<\/strong> into your WordPress charts and make them <strong>fully dynamic<\/strong>! \ud83d\ude80<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-add-header-key-and-header-token\">How to add Header Key and Header Token<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to use header for Api in graphina elemetor charts and graph plugin | Iqonic Design\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/yoyICYymhjg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Some APIs use API keys for authorization.<\/p>\n\n\n\n<p>An API key is&nbsp;a special token that the client needs to provide when making API calls.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>&nbsp;Follow the below steps to learn how to create WordPress charts from external API\u2019s \u2013&nbsp;<\/strong><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-1-selection-of-chart\">Step 1 \u2013&nbsp; Selection of Chart&nbsp;<\/h4>\n\n\n\n<p><a href=\"https:\/\/apps.iqonic.design\/docs\/product\/graphina-elementor-charts-and-graphs\/use-dynamic-data-in-widgets\/data-from-api\/#step-1-selection-of-chart\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1300\" height=\"471\" src=\"https:\/\/apps.iqonic.design\/docs\/wp-content\/uploads\/2022\/02\/api1.png\" alt=\"\"><\/p>\n\n\n\n<p>Open Graphina \u2013&nbsp;<strong>WordPress Chart Plugin&nbsp;<\/strong>and&nbsp;<strong>select&nbsp;<\/strong>the chart where you want to display the data of google sheet.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-2-changing-data-option-from-manual-to-dynamic\">Step 2 \u2013 Changing Data Option from Manual to Dynamic<\/h4>\n\n\n\n<p><a href=\"https:\/\/apps.iqonic.design\/docs\/product\/graphina-elementor-charts-and-graphs\/use-dynamic-data-in-widgets\/data-from-api\/#step-2-changing-data-option-from-manual-to-dynamic\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1299\" height=\"468\" src=\"https:\/\/apps.iqonic.design\/docs\/wp-content\/uploads\/2022\/02\/api2.png\" alt=\"\"><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Select&nbsp;the chart data option&nbsp;and change the time from&nbsp;\u201cmanual\u201d to \u201cdynamic\u201d&nbsp;and we can see the message of the no data available because we have not selected the data source till now.&nbsp;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-3-adding-wordpress-charts-from-external-api-s\">Step 3 \u2013 Adding WordPress Charts from External API\u2019s<\/h4>\n\n\n\n<p><a href=\"https:\/\/apps.iqonic.design\/docs\/product\/graphina-elementor-charts-and-graphs\/use-dynamic-data-in-widgets\/data-from-api\/#step-3-adding-wordpress-charts-from-external-api-s\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1296\" height=\"471\" src=\"https:\/\/apps.iqonic.design\/docs\/wp-content\/uploads\/2022\/02\/api3.png\" alt=\"\"><\/p>\n\n\n\n<p>Select the&nbsp;<strong>dynamic data option<\/strong>&nbsp;and&nbsp;<strong>change&nbsp;<\/strong>the type to&nbsp;<strong>\u201cAPI.\u201d<\/strong><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1297\" height=\"472\" src=\"https:\/\/apps.iqonic.design\/docs\/wp-content\/uploads\/2022\/02\/api31.png\" alt=\"\"><\/p>\n\n\n\n<p>Below, you have the option to&nbsp;<strong>paste&nbsp;<\/strong>the&nbsp;<strong>URL link<\/strong>.&nbsp;<\/p>\n\n\n\n<p>So now you have the option to paste the&nbsp;<strong>URL<\/strong>,&nbsp;<strong>copy it, and paste it to the given box.<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"step-4-increasing-elements\">Step 4 \u2013 Increasing Elements<\/h4>\n\n\n\n<p><a href=\"https:\/\/apps.iqonic.design\/docs\/product\/graphina-elementor-charts-and-graphs\/use-dynamic-data-in-widgets\/data-from-api\/#step-4-increasing-elements\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1304\" height=\"475\" src=\"https:\/\/apps.iqonic.design\/docs\/wp-content\/uploads\/2022\/02\/api4.png\" alt=\"\"><\/p>\n\n\n\n<p>Here on the chart, you can see there are five elements select the&nbsp;\u201cchart data option\u201d&nbsp;and&nbsp;increase&nbsp;the data element by&nbsp;5,&nbsp;and you will be able to see the changes on your page. And the data of the API is displayed here with the<strong>&nbsp;least amount of effort.<\/strong><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Introduction If you\u2019ve been following my blog, you know how much I love creating data visualization charts in WordPress. But what if you could fetch live data from an API without writing a single line of code? In this guide, we\u2019ll learn how to convert a static chart into a fully dynamic chart using an [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"parent":235,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-327","post","type-post","status-publish","format-standard","hentry","category-graphina"],"featured_image_src":null,"author_info":{"display_name":"wordpressadminiq","author_link":"https:\/\/documentation.iqonic.design\/graphina\/author\/wordpressadminiq\/"},"children":[],"_links":{"self":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":3,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/327\/revisions"}],"predecessor-version":[{"id":486,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/327\/revisions\/486"}],"up":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/235"}],"wp:attachment":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/categories?post=327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/tags?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}