The GET MethodGET is the most frequently used Hypertext Transfer Protocol (HTTP) in which the browser requests a web resource from the web server. A GET Request Message uses the same format as other Request Messages, replacing the Request Method in the Request Line with "GET" as shown below:
GET WebAddress HTTP-Version
The Request Headers and Request Message Body are both optional when using the GET method.
In order to use the GET method type with Quorum we will have to use the "Libraries.Network.NetworkRequest" library. Then we will create a NetworkRequestType "type" which we will set to GET as shown below:
use Libraries.Network.NetworkRequest use Libraries.Network.NetworkRequestType class Main action Main //creates a NetworkRequestType object "type"and sets "type" to //the GET method NetworkRequestType type type:SetToGet()
We will then create a NetworkRequest object "request" and set its RequestType to "type" (GET) as shown below:
//creates a NetworkRequest object "request" and uses "type" //(which is already set to GET) as the parameter in //SetRequestType() NetworkRequest request request:SetRequestType(type)
Here is the complete code section to set the RequestType to GET and then return the RequestType as output to the screen:
use Libraries.Network.NetworkRequest use Libraries.Network.NetworkRequestType class Main action Main NetworkRequest request NetworkRequestType type type:SetToGet() request:SetRequestType(type) output request:GetRequestType() end end
This code will output the Request Type we have set to GET
The output should look like this letting us know that our NetworkRequestType (method) is set to GET:
In the next tutorial, we will discuss the POST Method, which describes an introduction to sending a request message using the Hypertext Transfer Protocol (HTTP) POST Method..