Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
mario_xp
Contributor
Contributor

Rest API connecting with json in header

I need to connect to the application api I got the php code from the company to connect, but I am not able to connect after Rest Api you have any idea how to connect using the code below I do not want to use intermediaries, but connect directly to Qlik Sens.
Do you have any idea how to connect?

Another problem is when the url query, the result of which should be json from the browser level, the data is presented and at the time of using the Rest API there is a problem I get a 500 error.
I tested it with python and I have two parameters set allow_redirects = True, verify = False

Of course, I set it in Rest
Certificate validation = Skip Server Certificate Validation

https://api.test.pl/api/contact/getFullData?access_token=TJiNmFmYjNjYj

 

 

 

<?php

$base_url = 'https://api.test.pl';

$bussinessParams = array(
    'UWAGI' => 'TU PRZYKŁADOWY WPIS DO POLA UWAGI',
    'ph__TELEFON' => '123123123'
);

$data = [
    'campaignId'         => 1 
    ,'priority'          => 100 
    ,'statusId'          => 2 	
	//,'agentId'		 => 2 
	,'businessParams'    => json_encode($bussinessParams)
];

$uri = $base_url . '/api/contact/new';
$curlHandler = curl_init();
$data_string = json_encode($data);
$header=array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string));
	

curl_setopt($curlHandler, CURLOPT_URL, $uri . '?access_token=TJiNmFmYjNjYj');
curl_setopt($curlHandler, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($curlHandler, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandler, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlHandler, CURLINFO_HEADER_OUT, true);
curl_setopt($curlHandler, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curlHandler, CURLOPT_HTTPHEADER, $header);
$info = curl_getinfo($curlHandler);
$result = json_decode(curl_exec($curlHandler));
$httpCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
curl_close($curlHandler);

echo "<pre>".$result."</pre>";

?>
 

 

 

 

Labels (1)
  • SaaS

0 Replies