Subscribe Bookmark RSS Feed

Calling RESTful Web Services from JMP

bernie

Community Member

Joined:

Jul 30, 2012

Is there a way to invoke a restful web service from JMP? If so, are there any code examples that can be shared?RESTful Web Services from within JMP

2 REPLIES
landon

Super User

Joined:

Jun 23, 2011

We were recently looking to call some REST APIs (like hitting a Hadoop cluster and running a custom task in pig or spark) from JMP/JSL... and ended up using the Open function with a custom URL that gets generated from user inputs. This is similar to what can be done manually using File -> Internet Open with the 'Open As' set to Data (as pointed out by many Discussions). Our REST API returns CSV/TSV formatted text that is easily imported by JMP.

We did run into issues with timeouts due to the WinINet API (see https://msdn.microsoft.com/en-us/library/windows/desktop/aa384066(v=vs.85).aspx where WINHTTP_OPTION_RECEIVE_TIMEOUT has a default value of 30 seconds), and would get an error with "The operation timed out". We ended up adding the code below to our JSL Script to add a registry item to extend/override the default timeout (following the fix mentioned at https://support.microsoft.com/en-us/kb/181050).

RP = RunProgram(

  Executable( "reg" ),

  Options(

  {"add",

  "\!"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\!" /v \!"ReceiveTimeout\!" /t REG_DWORD /d \!"0x493E0\!" /f"

  }

  ),

  ReadFunction( "text" )

);

landon

Super User

Joined:

Jun 23, 2011

Reminder for my future self... of this features available in JMP 13

The Internet Open Timeout preference on the General preference page applies to opening web pages with the Internet Open feature. JMP waits the specified number of seconds before stopping the import due to an error. 60 seconds is the default value.

and the new http request function coming in JMP 14.