<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using JSON in a &amp;quot;GET&amp;quot; HTTP Request in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195199#M41608</link>
    <description>&lt;P&gt;"GET"&lt;/P&gt;
&lt;P&gt;and "POST"&lt;/P&gt;
&lt;P&gt;are two different HTTP request methods (&lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods" target="_self"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;"GET" typically reads data from a server while&lt;/P&gt;
&lt;P&gt;"Post" typically submits data to a server.&lt;/P&gt;
&lt;P&gt;These are Web Server/Web Service defined outside of JMP/JSL&lt;/P&gt;
&lt;P&gt;In your first example, you are "POST"-ing (aka submitting) data to "http://fc8tdbitmapconvs07:11111/daas/" and telling the service that &lt;STRONG&gt;ctfn&lt;/STRONG&gt; is the JSON content to use.&lt;/P&gt;
&lt;P&gt;In Attempt#1, the goal is "GET"-ting the status of a running job. I'm not sure what the service is, but if the endpoint is "http://fc8tdbitmapconvs07:11111/daas/status/", then you'd want something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request2 = New HTTP Request(
url( "http://fc8tdbitmapconvs07:11111/daas/status/" ),
Method( "GET" )
);

data2 = request2 &amp;lt;&amp;lt; Send;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you wouldn't be submitting anything to the server in a GET.&lt;/P&gt;
&lt;P&gt;Additionaly, "Content-Type:application/json" is used to describe the content you are sending (not really appropriate in a GET since you are recieving data and probably ignored by the web server)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Content-Type:&lt;/STRONG&gt; headers are what you are sending (these are automatically set by HTTP Request)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Accept:&lt;/STRONG&gt; headers are what you tell the web server you'd like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Get MIME Type&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will tell you what the web server sent. (most web servers set this, but it can be empty)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind, too that after any&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Send&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Get Status; //this is the http status code
request &amp;lt;&amp;lt; Get Status Message; //this is the message from the server&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to investigate any error message the Web Service emits.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2019 17:50:35 GMT</pubDate>
    <dc:creator>bryan_boone</dc:creator>
    <dc:date>2019-04-26T17:50:35Z</dc:date>
    <item>
      <title>Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195164#M41605</link>
      <description>&lt;P&gt;I'm working to interface with our data retrieval engine.&amp;nbsp; I can submit a job perfectly fine using a POST request like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;request = New HTTP Request(&lt;BR /&gt;url( "http://fc8tdbitmapconvs07:11111/daas/" ),&lt;BR /&gt;Method( "POST" ),&lt;BR /&gt;Json( Load Text File( ctfn ) )&lt;BR /&gt;);&lt;BR /&gt;data = request &amp;lt;&amp;lt; Send;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'data' contains the response from the server and all is well.&lt;/P&gt;&lt;P&gt;-------------------------------------------&lt;/P&gt;&lt;P&gt;However, when I try and check on the status of the running job with a 'GET' request the json does not get included in the HTTP request to the server:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Attempt#1:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;request2 = New HTTP Request(&lt;BR /&gt;url( "http://fc8tdbitmapconvs07:11111/daas/status/" ),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Method( "GET" ),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; headers( {"Content-Type:application/json"} ), // add your custom headers&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Json( Load Text File( ctfn2 ) )&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;data2 = request2 &amp;lt;&amp;lt; Send;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Attempt#2&lt;/U&gt;&lt;/P&gt;&lt;P&gt;request2 = New HTTP Request(&lt;BR /&gt;url( "http://fc8tdbitmapconvs07:11111/daas/status/" ),&lt;BR /&gt;Method( "GET" ),&lt;BR /&gt;headers( {"Content-Type:application/json"} ) // add your custom headers&lt;BR /&gt;);&lt;BR /&gt;request2 &amp;lt;&amp;lt;Json( Load Text File( ctfn2 ) );&lt;BR /&gt;data2 = request2 &amp;lt;&amp;lt; Send;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In both cases the JSON fails to load.&amp;nbsp; The header information makes it to the server just fine but the spot where the JSON should be in the request is empty.&amp;nbsp; What am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 15:18:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195164#M41605</guid>
      <dc:creator>vt_sailor</dc:creator>
      <dc:date>2019-04-26T15:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195199#M41608</link>
      <description>&lt;P&gt;"GET"&lt;/P&gt;
&lt;P&gt;and "POST"&lt;/P&gt;
&lt;P&gt;are two different HTTP request methods (&lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods" target="_self"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;"GET" typically reads data from a server while&lt;/P&gt;
&lt;P&gt;"Post" typically submits data to a server.&lt;/P&gt;
&lt;P&gt;These are Web Server/Web Service defined outside of JMP/JSL&lt;/P&gt;
&lt;P&gt;In your first example, you are "POST"-ing (aka submitting) data to "http://fc8tdbitmapconvs07:11111/daas/" and telling the service that &lt;STRONG&gt;ctfn&lt;/STRONG&gt; is the JSON content to use.&lt;/P&gt;
&lt;P&gt;In Attempt#1, the goal is "GET"-ting the status of a running job. I'm not sure what the service is, but if the endpoint is "http://fc8tdbitmapconvs07:11111/daas/status/", then you'd want something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request2 = New HTTP Request(
url( "http://fc8tdbitmapconvs07:11111/daas/status/" ),
Method( "GET" )
);

data2 = request2 &amp;lt;&amp;lt; Send;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you wouldn't be submitting anything to the server in a GET.&lt;/P&gt;
&lt;P&gt;Additionaly, "Content-Type:application/json" is used to describe the content you are sending (not really appropriate in a GET since you are recieving data and probably ignored by the web server)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Content-Type:&lt;/STRONG&gt; headers are what you are sending (these are automatically set by HTTP Request)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Accept:&lt;/STRONG&gt; headers are what you tell the web server you'd like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Get MIME Type&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will tell you what the web server sent. (most web servers set this, but it can be empty)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind, too that after any&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Send&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request &amp;lt;&amp;lt; Get Status; //this is the http status code
request &amp;lt;&amp;lt; Get Status Message; //this is the message from the server&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to investigate any error message the Web Service emits.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 17:50:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195199#M41608</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-04-26T17:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195200#M41609</link>
      <description>bryan_boone,&lt;BR /&gt;&lt;BR /&gt;Thank you for the quick response. According to the developer who wrote the&lt;BR /&gt;REST API the JSON is required. Here's the working version in Python&lt;BR /&gt;&lt;BR /&gt;status_info = get(&lt;BR /&gt;'http://fc8tdbitmapconvs07:11111/daas/status/',&lt;BR /&gt;json={'_id': '5cc311a97925b1000ce4fd54', 'include_complete':&lt;BR /&gt;True}&lt;BR /&gt;).json()&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; the long number in red is the job number which of course varies. This&lt;BR /&gt;bit works fine running in a python notebook or running inside JMP using the&lt;BR /&gt;following JSL. But, how do I get it to work with the HTTP Request protocol?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Python Init();&lt;BR /&gt;Python Execute(&lt;BR /&gt;{x},&lt;BR /&gt;{status_info},&lt;BR /&gt;"&lt;BR /&gt;import getpass&lt;BR /&gt;from io import BytesIO&lt;BR /&gt;from time import sleep&lt;BR /&gt;&lt;BR /&gt;import pandas as pd&lt;BR /&gt;from requests import get, post&lt;BR /&gt;&lt;BR /&gt;status_info = get(&lt;BR /&gt;'http://fc8tdbitmapconvs07:11111/daas/status/',&lt;BR /&gt;json={'_id': '5cc311a97925b1000ce4fd54', 'include_complete':&lt;BR /&gt;True}&lt;BR /&gt;).json()&lt;BR /&gt;&lt;BR /&gt;"&lt;BR /&gt;);&lt;BR /&gt;Python Term();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Apr 2019 18:00:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195200#M41609</guid>
      <dc:creator>vt_sailor</dc:creator>
      <dc:date>2019-04-26T18:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195201#M41610</link>
      <description>&lt;P&gt;Is the JSON embedded in a request header? (Dropbox, Onedrive, and many others do that)&lt;/P&gt;
&lt;P&gt;The JSON argument in the HTTP Request used in a POST/PATCH/PUT where the content is sent with the JSON content type.&amp;nbsp; It is a "submit" action.&lt;/P&gt;
&lt;P&gt;GET are "read" and arguments are either query strings or embeded in a request header.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 18:09:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195201#M41610</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-04-26T18:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195204#M41611</link>
      <description>&lt;P&gt;After reading up on the HTTP Spec, I see that sending data with a GET is discouraged and that servers usually ignore it.&lt;/P&gt;
&lt;P&gt;I found this discussion on stackoverflow, which links to the relevant HTTP specs.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/5216567/is-this-statement-correct-http-get-method-always-has-no-message-body" target="_self"&gt;Is this statement correct? HTTP GET method always has no message body&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It basically boils do to some custom webservice implementations might use it and the spec is pretty nebulous about it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe I can get something in for JMP 15 if the need still exists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there any other avenues to interact with this serviece?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 22:20:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/195204#M41611</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-04-26T22:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/196407#M41651</link>
      <description>&lt;P&gt;Bryon,&lt;/P&gt;&lt;P&gt;Thank you for the quick reply.&amp;nbsp; I'm working directly with the developer for the REST API and packaging the JSON in a GET request is their documented way of requesting data.&amp;nbsp; You're correct that the spec is not clear and packaging JSON in a GET request is what is taught in some CS curriculums.&amp;nbsp; In this instance the idea is to pass in a job number which will return either a code indicating the job is not yet complete (poll &amp;amp; response) or a code indicating that it is complete, the data file names and a zip file containing these files.&amp;nbsp; If you could get something into JMP 15 that would be very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 11:58:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/196407#M41651</guid>
      <dc:creator>vt_sailor</dc:creator>
      <dc:date>2019-04-30T11:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/197911#M41667</link>
      <description>&lt;P&gt;One last thing (or 2).&amp;nbsp; can the Job Number, etc be passed as a query string parameter (or even JSON can be embedded in the request header)&lt;/P&gt;
&lt;P&gt;and 2, be sure to add the get with a "body" to the wish list.&amp;nbsp; That way we can keep track and you can be notified when it's there.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;-Bryan&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 19:26:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/197911#M41667</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-04-30T19:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using JSON in a "GET" HTTP Request</title>
      <link>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/236589#M46690</link>
      <description>&lt;P&gt;This feature (using "GET" while sending JSON) should be available in JMP 15.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 19:12:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-JSON-in-a-quot-GET-quot-HTTP-Request/m-p/236589#M46690</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-11-26T19:12:58Z</dc:date>
    </item>
  </channel>
</rss>

