Skip to main content

Handling HTTP Request Parameters

Handling HTTP Request Parameters

When you send an HTTP request (see Sending the HTTP Request), you can include parameters in the location argument; for example: "/test.html?PARAM=%25VALUE" sets PARAM equal to %VALUE.

You can also use the following methods to control how your instance of %Net.HttpRequestOpens in a new tab handles parameters:

InsertParam()

Inserts a parameter into the request. This method takes two string arguments: the name of the parameter and the value of the parameter. For example:

 do req.InsertParam("arg1","1")

You can insert more than one value for a given parameter. If you do so, the values receive subscripts starting with 1. Within other methods, you use these subscripts to refer to the intended value.

DeleteParam()

Deletes a parameter from the request. The first argument is the name of the parameter. The second argument is the subscript for the value to delete; use this only if the request contains multiple values for the same parameter.

CountParam()

Counts the number of values that are associated with a given parameter.

GetParam()

Gets the value of a given parameter in the request. The first argument is the name of the parameter. The second argument is the default value to return if the request does not have a parameter with this name; the initial value for this default is the null value. The third argument is the subscript for the value to get; use this only if the request contains multiple values for the same parameter.

IsParamDefined()

Checks whether a given parameter is defined. This method returns true if the parameter has a value. The arguments are the same as for DeleteParam().

NextParam()

Retrieves the name of the next parameter, if any, after sorting the parameter names via $Order().

ReturnParams()

Returns the list of parameters in this request.

For details, see the class documentation for %Net.HttpRequestOpens in a new tab.

FeedbackOpens in a new tab