<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Qlik REST API GET /v1/data-sets/{data-set-id} endpoint returns 401  to OPTIONS request in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-REST-API-GET-v1-data-sets-data-set-id-endpoint-returns-401/m-p/2487500#M21390</link>
    <description>&lt;P&gt;Hey there,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;I am using Qlik Cloud and trying to fetch dataset information using JS fetch API.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;The following code is sending an OPTIONS request and Qlik Cloud server responds with 401 to this request.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;async function getFields(dataset, tenantUrl, bearerToken, integrationId) {
    try {
        const response = await fetch(`${tenantUrl}/api/v1/data-sets/${dataset}`, {
            method: 'GET',
            headers: {
                'Authorization': `Bearer ${bearerToken}`,
                'Content-Type': 'application/json',
                'qlik-web-integration-id': `${integrationId}`,
            }
        });
        const data = await response.json();
        return data['schema']['dataFields'];
    } catch (error) {
        console.error('Error fetching fields:', error);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;I tried the method suggested in this post and was able to send this request without any issues.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;When I disabled web security in my Chrome browser, there were no preflight requests.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Response-to-preflight-request-doesn-t-pass-access/ta-p/1716584" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Response-to-preflight-request-doesn-t-pass-access/ta-p/1716584&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The following code also sends OPTIONS requests without any problem, the server responds with 204.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;async function getItems(tenantUrl, bearerToken, integrationId) {
    try {
        const response = await fetch(`${tenantUrl}/api/v1/items`, {
            method: 'GET',
            headers: {
                'Authorization': `Bearer ${bearerToken}`,
                'Content-Type': 'application/json',
                'qlik-web-integration-id': `${integrationId}`,
            }
        });
        const data = await response.json();
        return data['data'];
    } catch (error) {
        console.error('Error fetching datasets:', error);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't get this error on any endpoint other than this one. I only use the fetch API without any third-party library. Why this is happening?&lt;/P&gt;
&lt;P&gt;update: I also got this error with this request GET /v1/data-sets/{data-set-id}/profiles&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that there is a common issue with requests related to data sets.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 17:46:48 GMT</pubDate>
    <dc:creator>yomato</dc:creator>
    <dc:date>2024-10-17T17:46:48Z</dc:date>
    <item>
      <title>Qlik REST API GET /v1/data-sets/{data-set-id} endpoint returns 401  to OPTIONS request</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-REST-API-GET-v1-data-sets-data-set-id-endpoint-returns-401/m-p/2487500#M21390</link>
      <description>&lt;P&gt;Hey there,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;I am using Qlik Cloud and trying to fetch dataset information using JS fetch API.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;The following code is sending an OPTIONS request and Qlik Cloud server responds with 401 to this request.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;async function getFields(dataset, tenantUrl, bearerToken, integrationId) {
    try {
        const response = await fetch(`${tenantUrl}/api/v1/data-sets/${dataset}`, {
            method: 'GET',
            headers: {
                'Authorization': `Bearer ${bearerToken}`,
                'Content-Type': 'application/json',
                'qlik-web-integration-id': `${integrationId}`,
            }
        });
        const data = await response.json();
        return data['schema']['dataFields'];
    } catch (error) {
        console.error('Error fetching fields:', error);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;I tried the method suggested in this post and was able to send this request without any issues.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;When I disabled web security in my Chrome browser, there were no preflight requests.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Response-to-preflight-request-doesn-t-pass-access/ta-p/1716584" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Response-to-preflight-request-doesn-t-pass-access/ta-p/1716584&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The following code also sends OPTIONS requests without any problem, the server responds with 204.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;async function getItems(tenantUrl, bearerToken, integrationId) {
    try {
        const response = await fetch(`${tenantUrl}/api/v1/items`, {
            method: 'GET',
            headers: {
                'Authorization': `Bearer ${bearerToken}`,
                'Content-Type': 'application/json',
                'qlik-web-integration-id': `${integrationId}`,
            }
        });
        const data = await response.json();
        return data['data'];
    } catch (error) {
        console.error('Error fetching datasets:', error);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't get this error on any endpoint other than this one. I only use the fetch API without any third-party library. Why this is happening?&lt;/P&gt;
&lt;P&gt;update: I also got this error with this request GET /v1/data-sets/{data-set-id}/profiles&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that there is a common issue with requests related to data sets.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 17:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-REST-API-GET-v1-data-sets-data-set-id-endpoint-returns-401/m-p/2487500#M21390</guid>
      <dc:creator>yomato</dc:creator>
      <dc:date>2024-10-17T17:46:48Z</dc:date>
    </item>
  </channel>
</rss>

