-
1. Re: JSON Sample Connector Thread
Jack DeWeese Oct 28, 2015 1:41 PM (in response to Nicolas Brisoux)I was trying out the examples for the data connector, but I am getting the following error message from the JSON connector: "Uncaught Looks like the WDC is calling a tableau function before tableau.init() has been called."
Any advice to what I can do to fix this? I am running the lightweight Python web server, and I got the base Simulator.html to work, but may have missed something I needed to do for the JSON example.
-
2. Re: JSON Sample Connector Thread
Brendan LeeOct 28, 2015 5:45 PM (in response to Jack DeWeese)
Hey Jack,
That error is a bit unclear as it shows up in a number of different situations. Are you using the latest version of the sample and the WDC SDK? The latest version of the SDK is hosted here (https://public.tableau.com/javascripts/api/tableauwdc-1.1.0.js).
We also have a hosted version of the JSON connector, could you give that a try and see if you still have issues? The hosted version is found here: json Connector
You can just point the WDC browser in Tableau to that location.
- Brendan
-
3. Re: JSON Sample Connector Thread
Jack DeWeese Oct 29, 2015 7:36 AM (in response to Brendan Lee)Hey Brendan,
Thanks for the reply! Your last comment was actually the tip-off that I was using the connector completely wrong. I thought I could test the connector by itself (http://localhost:8888/Examples/jsonConnector.html), instead of putting it into the simulator: http://localhost:8888/Simulator.html?src=Examples/jsonConnector.html. Works like a charm now that I'm using it correctly!
Thanks,
Jack
-
4. Re: JSON Sample Connector Thread
Meg Hunt Nov 9, 2015 3:02 PM (in response to Nicolas Brisoux)Hi Nicolas,
I am trying to use the JSON data connector to import data from the ROARMAP respository (http://roarmap.eprints.org/), of which I am an admin. When I export the data from the search function and try to send the JSON URL link (http://roarmap.eprints.org/cgi/search/archive/advanced/export_roarmap_JSON.js?screen=Search&dataset=archive&_action_expo…) through the Web Data Connector in Tableau Public it takes a long time to process the request and then I get the following error message:
An error occurred while communicating with the data source. Unable to connect to the server. Check that the server is running and that you have access privileges to the requested database.
- The table "[TableauTemp].[webdata.42317.956567546295]" does not exist.
The data seems to go in okay when just copied and pasted but would make my life a lot easier if I could use the URL instead. Any idea what the problem might be?
Any help gratefully received.
Kind regards,
Meg
-
5. Re: JSON Sample Connector Thread
Nicolas BrisouxNov 10, 2015 8:55 PM (in response to Meg Hunt)
HI Meg,
I was able to reproduce the problem you are seeing. Digging into the logs I saw the following error:
XMLHttpRequest cannot load http://roarmap.eprints.org/cgi/search/archive/advanced/export_roarmap_JSON.js?screen=Search&dataset=archive&_action_export=1&output=JSON&exp=0%7C1%7Cpolicymaker_name%7Carchive%7C-%7Cdeposit_of_item%3Adeposit_of_item%3AANY%3AEQ%3Arequired+requested+not_specified%7C-%7Ceprint_status%3Aeprint_status%3AANY%3AEQ%3Aarchive%7Cmetadata_visibility%3Ametadata_visibility%3AANY%3AEQ%3Ashow&n=&cache=18256. Origin http://localhost:8888 is not allowed by Access-Control-Allow-Origin."}
The bolded part indicates a CORS security restriction, which Desktop is enforcing in our current version.
Replace the function _retrieveJsonData with this code in jsonconnector.html (you are changing the datatype from json to jsonp0:
function _retrieveJsonData(retrieveDataCallback) {
if (!window.cachedTableData) {
var conData = JSON.parse(tableau.connectionData);
var jsonString = conData.jsonString;
if (conData.jsonUrl) {
var conUrl = _buildConnectionUrl(conData.jsonUrl);
// handle the json data from the remote source.
var xhr = $.ajax({
url: conUrl,
crossDomain: true,
dataType: 'jsonp',
success: function(data)
{
window.cachedTableData = _jsToTable(data);
retrieveDataCallback(window.cachedTableData);
}
});
return;
}
try {
window.cachedTableData = _jsToTable(JSON.parse(conData.jsonString));
}
catch (e) {
tableau.abortWithError("unable to parse json data");
return;
}
}
retrieveDataCallback(window.cachedTableData);
}
This worked for me.
-
6. Re: JSON Sample Connector Thread
Meg Hunt Nov 11, 2015 8:30 AM (in response to Nicolas Brisoux)Hi Nicolas,
Thank you so much for the reply. A friend helped me out by creating a new connector and swapping in the code you supplied, but unfortunately it doesn't seem to work for us. Tableau just responds with an endless 'Loading Metadata' screen. Here is our version: http://destruction.addedreality.net/jsonconnector.html
Any advice?
Kindest regards,
Meg
-
7. Re: JSON Sample Connector Thread
Katy Cabral Feb 18, 2016 12:40 PM (in response to Nicolas Brisoux)I am probably making a rookie mistake, but when i use the JSON connector, copying/pasting my JSON code into the box parses the data into columns just fine. When i enter the URL for the API into the connector, the query results are being parsed into a single data column. Any advice?
https://tableau.github.io/webdataconnector/Examples/jsonConnector.html
-
8. Re: JSON Sample Connector Thread
Katy Cabral Feb 29, 2016 7:25 AM (in response to Katy Cabral)Sorry for replying multiple times, but I'm hoping someone may see my latest post
Any hints as to what may be happening? Thanks in advance!!
-
9. Re: JSON Sample Connector Thread
Justin Fitzgerald Mar 25, 2016 2:30 PM (in response to Nicolas Brisoux)Hello,
I could use some help here. I created a JSON web data connector and tested it out in the simulator and it works fine. When I tried to connect to it via Tableau Desktop I get the following errors:
The URL points to a website, not a web data connector -- a web page with code to get data from a website.
and
An error occurred while communicating with the data source.
Tableau does not recognize the version of the web data connector API.
The version of Tableau you are using cannot use the web data connector that you are trying to access. The connector requires at least version '1.1.1' of the web data connector API.
My WDC is loading 1.1.1:
<script src="https://connectors.tableau.com/libs/tableauwdc-1.1.1.js" type="text/javascript"></script> and I am using Tableau Desktion 9.2.
How do I resolve this issue?
-
10. Re: JSON Sample Connector Thread
Brendan LeeMar 30, 2016 10:35 AM (in response to Justin Fitzgerald)
Hey Justin,
This was a bug that we fixed in a maintenance patch of Tableau Desktop. I believe this was fixed in 9.2.4, but I would recommend just updating to the latest version possible.Let me know if that doesn't solve your problem.
-Brendan
-
11. Re: JSON Sample Connector Thread
Tomasz Lechowicz Apr 4, 2016 5:54 AM (in response to Nicolas Brisoux)Hey,
I'm a newbie in topic of WDC. I was trying to play with this connector a little bit but I am constantly getting 'unable to parse json' error in Tableau. Could you give me a hint on how should I create my JSON to get it working? From what I've understood from connector source code I should use schema like this:
{
'headers': {
'foo': 'int',
'bar': 'int'
},
'rowData':[
{'foo': '1', 'bar': '1'},
{'foo': '2', 'bar': '3'}
]
}
could you give me a hint on how to change this schema to work?
-
12. Re: JSON Sample Connector Thread
Justin Fitzgerald Apr 4, 2016 4:00 PM (in response to Katy Cabral)Kate,
Can you confirm that your JSON connector is defining the getColumnsHeaders function appropriately?
https://onlinehelp.tableau.com/current/api/wdc/en-us/help.htm#WDC/wdc_ref.htm#connector_functions
-
13. Re: JSON Sample Connector Thread
Brendan LeeApr 4, 2016 5:20 PM (in response to Tomasz Lechowicz)
Hey Tomasz,
The example you pasted isn't valid JSON. You can use a tool like this one to check: https://jsonformatter.curiousconcept.com/
Try this:
{
"headers": {
"foo": "int",
"bar": "int"
},
"rowData":[
{"foo": 1, "bar": 1},
{"foo": 2, "bar": 3}
]
}
Keep in mind this connector is meant to serve merely as a developer sample for the API. It is not extremely robust and may not work in every scenario.
-Brendan
-
14. Re: JSON Sample Connector Thread
Leslie Foster Apr 13, 2016 11:22 AM (in response to Nicolas Brisoux)Hello, Brendan:
I have gathered that a format like below, is sufficient for the Tableau JSON Sample Connector's target URL. Even thought it does not resemble @Tomasz' format, I'm told it should work. BTW, I DID try changing to Tomasz' format.
[ { 'header' : 'value', 'header' : 'value', 'header' : 'value', … } , { 'header' : 'value', 'header' : 'value', 'header' : 'value', … } , { 'header' : 'value', 'header' : 'value', 'header' : 'value', … } , { 'header' : 'value', 'header' : 'value', 'header' : 'value', … } ]
My RESTful service produces data exactly as below (including the data field name/value). A point I would like to stress, is that this works if I take the text and simply paste it into the text area. But if I try and relay it using the URL box, it does not work. It gives me some sort of parse error.
Should data as below, work? If it is supposed to work, then could this be some kind of connectivity problem with my server? After all, I can pull back the results from a browser window.
{
"data": [
{
"action": "111:224:75.2,42.67,19.96:116.000,77.000,21.000",
"category": "something:else",
"event_time": "2016-03-14 11:31:19.0",
"id": 22492772246225,
"session_id": 82492739740998,
"tool_name": "Hammer",
"user_login": "alvinc",
"delta_seconds": 3
},
{
"action": "111:224:75.2,42.67,19.96:116.000,77.000,21.000",
"category": "something:else",
"event_time": "2016-03-14 11:34:06.0",
"id": 2.2492779248448e+18,
"session_id": 22492739740998,
"tool_name": "Hammer",
"user_login": "alvinc",
"delta_seconds": 2
}
]
}