cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
View Original Published Thread

access content of Web Page Box?

hogi
Level XII

I get an error message when I access a REST API via load text file()

load text file ("http://api.open-notify.org/iss-now.json");

On the other hand, it works when I use web()

New Window("", web browser = Web Browser Box ( "http://api.open-notify.org/iss-now.json", JMP window ));

 

Is there a way to retrieve the JSON string via the Web Page Box?

web browser << Get text;


 http://api.open-notify.org/iss-now.json is just used to explain the difference. With this API both approaches work.

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII


Re: access content of Web Page Box?

Next try:
save the content of the web page box and red the save file.

web browser << save ()

... but the saved file is empty: How to save webpages through JSL 

 

So, I use Selenium to directly access my External Web Browser and send the commands.

View solution in original post

9 REPLIES 9
jthi
Super User


Re: access content of Web Page Box?

Have you tried using New HTTP Request or Open?

Names Default To Here(1);

request = New HTTP Request(
	URL("http://api.open-notify.org/iss-now.json"),
	Method("GET")
);
data = request << Send;
aa = Parse JSON(data);

// dt = Open("http://api.open-notify.org/iss-now.json");
-Jarmo
hogi
Level XII


Re: access content of Web Page Box?

yes, I tried both.

hogi
Level XII


Re: access content of Web Page Box?

Seems that web() is using the web browser of my system - with the benefit of getting the access.

On the other hand this might prevent us from accessing the content? [out of reach for JMP?]

jthi
Super User


Re: access content of Web Page Box?

Might be worth trying to figure out why New HTTP Request doesn't work.

-Jarmo
hogi
Level XII


Re: access content of Web Page Box?

via Web(), it seems that JMP automatically inherits the permissions from the browser.

I just found:
https://community.jmp.com/t5/JMP-Wish-List/Additional-Wait-type-command/idi-p/626084

hogi_0-1736799376031.png

 

hogi
Level XII


Re: access content of Web Page Box?

Security setting prevent me from getting credentials via the embedded browser.


So I tried 

oauth2 = New OAuth2( Browser Type( "External" ) );


This way, the authentication works - but I don't get a"code" or "URL" which I could enter here:

hogi_1-1736799672588.png

hogi
Level XII


Re: access content of Web Page Box?

Next try:
save the content of the web page box and red the save file.

web browser << save ()

... but the saved file is empty: How to save webpages through JSL 

 

So, I use Selenium to directly access my External Web Browser and send the commands.

hogi
Level XII


Re: access content of Web Page Box?

To skip the Selenium part, is there some UseDefaultCredentials setting to use the credentials of my user account to access the files?

jthi
Super User


Re: access content of Web Page Box?

I would guess there is a cookie stored somewhere which you might be able to utilize. Are you able to contact the developers of the API and ask for them to create endpoint which could be used with some other authentication method?

-Jarmo