How do I write a script to open a table that is on an Atlassian Page ? I tried below
dt = open("https://impinj.atlassian.net/wiki/spaces/UNI/pages/79855941/12+AOI+Disposition-2022", html table(1));
I am using JMP17.
Hi,
I could not test your problem because the link in your question requires a password.
I am unfamiliar with using the OPEN command to directly import the content of a web page as a data table. Are you sure that it is the right method? If you are, there might be an issue with your access privilege for that specific page.
If you are not, I suggest using the manual method described below to assess if the page can be downloaded as a data table.
Let us know what you find.
Best,
TS
Hello Thierry,
I could not open the table using your method. There is a table on the webpage but it says it could not find it.
JMP could not find <table> elements in the html it received. Maybe one of these:
Open the table in a browser and use the right-click->view source option to see if there are <table>, <tr>, and <td> elements in the html. <tr>...</tr> for each row and <td>...</td> for each data value.
Try
write(loadtextfile("https://..."))
and check the log. Study the html to see if it looks like your table or an error message or a login prompt.
I'm pretty sure JMP is seeing the login page, not the page with the table.
If this is a one time download, @Thierry_S has the best answer:
Pick the web page option.Login, go to the page you need, then the high lighted button.
If you need to script this for many runs...
There is a good chance the site has an API to help you fetch the data, possibly as a .CSV file. https://developer.atlassian.com/ That API will also have a way to provide your credentials to use the site. JMP's httprequest will help if you go that route. This is the best choice. You may need the NewOAuth2 example from the scripting index to help figure this out; it shows how the credential process might work. @bryan_boone
Or, something like Browser Scripting with Python Selenium will let you write JSL+Python to navigate the site. Complicated, this is not the best choice if an API is available.
Much of the data in Atlassian (Confluence and Jira) is non-tabular and has customizable fields. In short, it's JSON, at least from the REST endpoint perspective.
The easiest way to get started is by creating a Personal Access Token (PAT) in your Atlassian. I did a while back (as you can see from the screen shot) but I still had to hunt around for it https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html
In my case, I used JMP to track Jira's for me (read only)
I used Jira's REST api v2https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#about
The key thing to remember is that every REST call will need the API token like:
PAT_TOKEN = ""; JIRA_URL = "https://rndjira.mine/rest/api/2"; JIRA_USER = ""; user = Encode URI( JIRA_USER ); query = "startAt=0&maxResults=500&jql=assignee=" || user; url = JIRA_URL || "/search?" || query; request = New HTTPRequest ( Headers({"Authorization: Bearer " || PAT_TOKEN}), Method( "GET" ), URL( url ) ); json = request << Send; json_aa = [=>]; If( request << Is Successful(), json_aa = Parse JSON( json ); );
json_aa is the returned JSON parsed into a JSL Associative Array.
You may want to do something like:
write("!\n" || Char(json) || "!\n");
And put the output into a JSON Editor so you can see the returned JSON data structure.