Qlik Community

Qlik Sense Data Connectivity

Discussion board where members can learn more about Qlik Sense Data Connectivity.

Highlighted
mikkeltaylor
Contributor II

REST API - Help connecting to Twitter please?

Hi,  Over the xmas period (at work) I was really looking forward to trying out the new REST API connector and pulling some simple data from Twitter to be able to put into a Qlik dashboard to show management.   Unfortunately, I'm stuck with setting up the connection , so would really appreciate the support of this community .

I thought I would start with one of the simple such as the trends/place API - https://api.twitter.com/1.1/trends/place.json

2016-01-05 07_54_20-REST Connection.png

When it goes through to the next screen I am only given the option of CSV , so when I try to change this to JSON I get an error saying invalid response type.  I've tried with and without id=1 (worldwide) and also adding it to the query parameters.

Can anyone help and do you have a simple example I can try to replicate please?

Thanks

Michael

1 Solution

Accepted Solutions
Support
Support

Re: REST API - Help connecting to Twitter please?

Hi Lars.

Please have a look atProblem with Authorization token in Google Analyticswhich may help you resolve your issue.

Best,

Bjorn

13 Replies

Re: REST API - Help connecting to Twitter please?

Have you tried to fallow the manual?

mikkeltaylor
Contributor II

Re: REST API - Help connecting to Twitter please?

Yes, of course, but that only takes you as far as the screenshot above. I've also used the online guide, but it assumes no errors....

Employee
Employee

Re: REST API - Help connecting to Twitter please?

Hi Michael - I am looking at this now - I will let you know what I find shortly.

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
Employee
Employee

Re: REST API - Help connecting to Twitter please?

Hi Michael - did you get the API to work in the Twitter console first?

API Console Tool | Twitter Developers

I did this for the trends closest API - once I got the OK response - I copied the appropriate parameters in the REST Connector:

https://api.twitter.com/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116

rest.png

This worked for me -- however:

this API https://api.twitter.com/1.1/trends/place.json does not work in the console - I get a 404 page not found:

So I think the problem might be with the twitter REST API itself.

Let me know what you find.

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
mikkeltaylor
Contributor II

Re: REST API - Help connecting to Twitter please?

Hi Mike,  I'm pretty sure I did get this to work through the Twitter API console, but I'll test again later to be sure.

The actual error message I recieved was when went to the next screen and tried to choose "JSON" as the response type.  Did you try that too?

Also, what type of details did you put behind the blanked out boxes, as the PDF guide only has the ones you haven't blanked out.

Thanks

Michael

Employee
Employee

Re: REST API - Help connecting to Twitter please?

Hi Michael - yes - the response I got back automatically displayed JSON, You can ignore the blanked out one, I did that to avoid confusion. I broke up a query parameter that was not needed and forgot to delete it from the box before taking the screenshot.

Let us know how you do.

Regards,
Mike Tarallo
Qlik
mikkeltaylor
Contributor II

Re: REST API - Help connecting to Twitter please?

Hi Michael - JSON doesn't get automatically chosen, but when I do select it manuallu I get the error mentioned above.

How do I find out what is causing the error?

Thanks, Michael

Support
Support

Re: REST API - Help connecting to Twitter please?

Hi Michael,

Easiest way to troubleshoot this would be to install Fiddler or any other web proxy to check the request/response to/from Twitter. It would then be easy to spot if Content-Type is set to application/json;charset=utf-8 in the response as it looks like you're not getting JSON back

There's nothing wrong with the URL https://api.twitter.com/1.1/trends/place.json?id=1 I tried it myself and works fine so that's not the issue here (you need to add an id or you will get 404 page not found back).

If authentication would be wrong, you would get an authentication error (401) so that doesn't seem to be the issue either:

Untitled.png

REST Connector should pick up the response type automatically if "Auto detect response type" is set. If you uncheck "Auto detect response type" you have the option on the next screen to select response type, but there shouldn't be any need for this in general.

See if you can download and run Fiddler. You should find the request in the left pane and in the bottom right pane you will see the response (select Raw to see the pure response being sent back). Check header content-type in the response:

Untitled.png

Partner
Partner

Re: REST API - Help connecting to Twitter please?

I have a similar issue when I try to connect to Google Analytics. I’m not able to find the correct Token. I can find one that I can use in the playground but it expires.

I have to make a dashboard for a customer where there shall be a few KPI’s from google analytics that updates every 2-3 minutes.

I have used my own credentials (Client ID and Client Secret) in the playground. Where should I look for the Oauth_consumer_key?

palyground.png

I can connect when I configure the query headers with

Name: Authorization

Value: Bearer ya29.ZwLGNIry0jEsjdNIAuMfpgVVfruff-ITbY_b5-q1IElw25FPCCc6TWDxrrJfcSAMQ6ho

The value is the access token I found in the OAuth playground. The problem is that the token expires and then I cannot connect any more.

connector.png