Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Lauri
Specialist
Specialist

Load external data with API

Is it possible to load data into Sense from an external source which has an API? The source system is web-based and uses mySQL. The API sample PHP code looks like this:

<?php

$data = array(

    'token' => 'asdf098ghqh',

    'content' => 'record',

    'format' => 'csv',

    'type' => 'flat',

    'fields' => array('abstractor_1','bmi_data_1'),

    'rawOrLabel' => 'raw',

    'rawOrLabelHeaders' => 'raw',

    'exportCheckboxLabel' => 'false',

    'exportSurveyFields' => 'false',

    'exportDataAccessGroups' => 'true',

    'returnFormat' => 'json'

);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://myurl.com/redcap/api/');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_VERBOSE, 0);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

curl_setopt($ch, CURLOPT_AUTOREFERER, true);

curl_setopt($ch, CURLOPT_MAXREDIRS, 10);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));

$output = curl_exec($ch);

print $output;

curl_close($ch);

Can I run or invoke this from Sense Enterprise? The API also allows for Java, cURL, Ruby, Perl, Python and R.

Thanks in advance.

1 Reply
joe_warbington
Luminary Alumni
Luminary Alumni

Connecting to REDCap APIs with Qlik Sense REST Connector:

The connection was simple but it did require one little feature that wasn’t super-obvious...

Basically, you have to add the Query Header circled in red below – not sure if it has to be the value below or not but I do know that ‘application/x-www-form-urlencoded’ works.

As for the other data, the actual API parameters are in the Request Body in the format you see below (no quotes or spaces, equal symbol between api parameter and its value, ampersands between the key-value pairs). The token does need to be added the string below for it to work.

2019-01-19 19_18_15-FW_ Pulling REDCap data directly into Qliksense - Message (HTML).png

REDCap is a secure web application for building and managing online surveys and databases. While REDCap can be used to collect virtually any type of data (including 21 CFR Part 11, FISMA, and HIPAA-compliant environments), it is specifically geared to support online or offline data capture for research studies and operations. The REDCap Consortium, a vast support network of collaborators, is composed of thousands of active institutional partners in over one hundred countries who utilize and support REDCap in various ways.