Qlik Community

Qlik Connectors Discussions

Discussion Board for collaboration regarding Qlik Connectors.

Highlighted
Blunck-TotalFitouts
New Contributor III

Restful API help - complete novice!

Hi everyone 🙂

I am need of some assistance setting up a restful API to our companies job management software, SimPro.

Here is there doco page - https://developer.simprogroup.com/apidoc/?page=57be307ee1bd93b729fdc4c13f15e201

I have attempted, for days now, literally, trying to make a restful API connection to SimPro using the wizard in QlikSense.  But I have failed, too many times to count!

Can someone help me out?

Thanks in advance!

Carl

Labels (3)
7 Replies
Highlighted
Mehrnaz
New Contributor

Re: Restful API help - complete novice!

Hi Carl,

I am not familiar with SimPro. I am pretty new too, but I have created  a couple API  connections in my app successfully. Some simple ones with key and some that required Bearer tokens.

Looking at your API documentations, I see that you need the followings to be added:

Authorization                   you have to check the documentations to see what goes here

Content-Type                   application/json

In one of my POST connections, I have added them under "Query headers" section.

The documentation page seems to have a lot of useful content. It is worth to go through examples in there.

Just a couple things that comes to my mind:

Are you prefixing the following before the endpoint url (<client> should be replaced with the name of whatever server they assigned to your company):

https://<client>.simprosuite.com/api/

Pay attention to the type of call (POST vs GET) If it's a post, you might need to add a body.

When you say "it doesn't work", what exactly doesn't work? I would suggest you try to hit the endpoint using "Postman". If successful, then the endpoint with your key works fine and you just have to fiddle with your script/wizard.

If the API runs fine and the load doesn't work, then the connector works and the script needs a bit of work.

Hope this helps.

Good Luck!

Mehrnaz

Highlighted
Blunck-TotalFitouts
New Contributor III

Re: Restful API help - complete novice!

Hi Mehrnaz,

Thanks for the tips so far! So I can get the connection to work fine through postman (Get) but when trying to make the connection through QlikSense, by using the create new connection wizard, I get the error message:

"HTTP protocol error 401 (Unauthorized): Request resource requires authentication."

I've gone with a basic authentication schema and placed my username and password in the boxes.  Then in the Additional request parameters section, I've got:

Name = access_token

Value = token given to me by SimPro

Do you know what I am doing wrong?

Thanks

Carl

Highlighted
Blunck-TotalFitouts
New Contributor III

Re: Restful API help - complete novice!

Hi again,

So I solved this problem, was putting the wrong URL in (lol).  Connection seems to work, but then when I go to load data from the table, this is the script I get... NO IDEA what this means (lol again).  Any info is greatly appreciated!  

The below returns nothing except for a faultString of "Unable able to parse GET request" which I assume means my connection is still not correct...

LIB CONNECT TO 'REST_httpstotalfitouts.simprosuite.comapi';
 
RestConnectorMasterTable:
SQL SELECT 
"result",
"id",
"__KEY_root",
(SELECT 
"faultCode",
"faultString",
"__FK_error"
FROM "error" FK "__FK_error")
FROM JSON (wrap on) "root" PK "__KEY_root";
 
[error]:
LOAD [faultCode],
[faultString],
[__FK_error] AS [__KEY_root]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_error]);
 
 
[root]:
LOAD [result],
[id],
[__KEY_root]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_root]);
 
 
DROP TABLE RestConnectorMasterTable;
Highlighted
Mehrnaz
New Contributor

Re: Restful API help - complete novice!

I haven't tried a "GET" yet, but these are what comes to my mind:

Did you add the following as your header also in addition to Authorization:

Name: Content-Type

Value: application/json

And if this doesn't solve it and if you are using "GET", are you passing in parameters into the URL? I remember that in a different environment, I had to convert spaces in my URL into the Hex value 20%, but I am not sure if the same would apply here.

Highlighted
prabhu0505
Valued Contributor

Re: Restful API help - complete novice!

Highlighted
Blunck-TotalFitouts
New Contributor III

Re: Restful API help - complete novice!

Thanks mate - added that in but still same issue unfortunately.

Highlighted
Blunck-TotalFitouts
New Contributor III

Re: Restful API help - complete novice!

Thanks mate - that sort of helps, but response type is JSON not XML and SimPro doesn't appear to accept CSV...