4D v14.3HTTP Request |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
HTTP Request
HTTP Request
The HTTP Request command enables all types of HTTP requests to be sent to a specific URL and processes the HTTP server response. Pass the HTTP method of the request in the httpMethod parameter. You can use one of the following constants, found in the HTTP Client theme:
Pass the URL where you want the request sent in the url parameter. The syntax to use is: http://[{user}:[{password}]@]host[:{port}][/{path}][?{queryString}] For example, you can pass the following strings: http://www.myserver.com (*) During HTTPS requests, authority of the certificate is not checked. Pass the body of the request in the contents parameter. Data passed in this parameter depends on the HTTP method of the request.
After command execution, the response parameter receives the result of the request returned by the server. This result corresponds to the body of the response, with no headers.
When you pass a C_OBJECT type variable in the response parameter, if the request returns a result with an "application/json" (or "something/json") content-type, 4D attempts to parse the JSON content in order to generate the object. If the result returned by the server does not correspond to the response variable type, it is left blank and the OK system variable is set to 0. In headerNames and headerValues, you pass arrays containing the names and values of the request headers. The * parameter enables the keep-alive mechanism for the server connection. By default, if this parameter is omitted, keep-alive is not enabled. The command returns a standard HTTP status code (200=OK and so on) as returned by the server. The list of HTTP status codes is provided in RFC 2616. Requesting for a record deletion from a remote database: C_TEXT($response) Note: You have to process the request appropriately on the remote server, HTTP Request only handles the request and the returned result. Requesting to add a record to a remote database: C_TEXT($response) Note: You have to process the request appropriately on the remote server, HTTP Request only handles the request and the returned result. Request to add a record in JSON to a remote database:: C_OBJECT($content) |
PROPERTIES
Product: 4D
HISTORY
SEE ALSO ARTICLE USAGE
4D Language Reference ( 4D v14 R2) Inherited from : HTTP Request ( 4D v13.5) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||