The POST MethodThe POST method is used by the browser to send, or POST, larger amounts of data to the server and create or update an existing resource. This additional data is added to the Message Body in the Request Message. A POST Request Message uses the same format as other Request Messages, replacing the Request Method in the Request Line with "POST" as shown below:
The POST method requires the Content-type and Content-length Request Headers which let the server know the media type and length of the Request Message Body. The Content-type Request Header is set automatically when using the SetBodyAsFormEncodedData() action, which will be discussed in the next tutorial.
POST WebAddress HTTP-Version
In order to use the POST method type with Quorum we will have to use the "Libraries.Network.NetworkRequest" library. We will then create a NetworkRequestType "type" which we will set to POST 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 POST method NetworkRequestType type type:SetToPost()
We will then create a NetworkRequest object "request" and set its RequestType to "type" (POST):
//creates a NetworkRequest object "request" and uses "type" //(which is already set to POST) as the parameter in //SetRequestType() NetworkRequest request request:SetRequestType(type)
Here is the complete code section to set the RequestType to POST 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:SetToPost() request:SetRequestType(type) output request:GetRequestType() end end
This code will output the Request Type we have set to POST
The output should look like this letting us know that our NetworkRequestType (method) is set to POST:
In the next tutorial, we will discuss Setting the Request Message Body, which describes an introduction to setting the request message body using the Hypertext Transfer Protocol (HTTP)..