system.net.httpPut
This function was deprecated in 8.3, use system.net.httpClient.put.
This function is used in Python Scripting.
Description
Performs an HTTP PUT to the given URL. Encodes the given dictionary of parameters using "applications/x-www-form-urlencoded" format.
Keep in mind that JRE proxy settings will influence how these functions conduct their network activities.
Client Permission Restrictions
This scripting function has no Client Permission restrictions.
Syntax
This function accepts keyword arguments.
system.net.httpPut(url, [contentType], putData, [connectTimeout], [readTimeout], [username], [password], [headerValues], [bypassCertValidation])
Parameters
Type | Parameter | Description |
---|---|---|
String | url | The URL to put to. |
String | contentType | The MIME type used in the HTTP 'Content-type' header. [optional] |
String | putData | The raw data to put via HTTP. |
Int | connectTimeout | The timeout for connecting to the URL in milliseconds. Default is 10,000. [optional] |
Int | readTimeout | The read timeout for the operation in milliseconds. Default is 60,000. [optional] |
String | username | If specified, the call will attempt to authenticate with basic HTTP authentication. [optional] |
String | password | The password used for basic HTTP authentication, if the username parameter is also present. [optional] |
Dictionary[String, String] | headerValues | A dictionary of name/value pairs that will be set in the HTTP header. [optional] |
Boolean | bypassCertValidation | If the target address in an HTTPS address, and this parameter is true, the system will bypass all SSL certificate validation. This is not recommended, though is sometimes necessary for self-signed certificates. [optional] |
Returns
String - The content returned for the PUT operation.
Scope
Gateway, Vision Client, Perspective Session
Syntax
system.net.httpPut(url, putParams)
Parameters
Type | Parameter | Description |
---|---|---|
String | url | The URL to send the request to. |
Dictionary[String, Integer] | putParams | A dictionary of name/value key pairs to use as the put data. |
Returns
String - The content returned for the PUT operation.
Scope
Gateway, Vision Client, Perspective Session
Code Examples
# The following example uses a test URL to echo back the data used in the PUT request.
# Test URL courtesy of:
# http://stackoverflow.com/questions/5725430/http-test-server-that-accepts-get-post-calls?answertab=votes#tab-top
# Specify URL and parameters to pass in the PUT call
URL = "http://httpbin.org/put"
params = {"testkey":"testValue"}
# Make the PUT request and print the results to the console
print system.net.httpPut(URL, params)
"""
This example attempts to authenticate with a username and password, as well as specify a MIME type.
The Username and password are static in this example, but could easily make use of other components to allow user input
or fetch data out of a database instead.
"""
URL = "http://httpbin.org/put"
params = {"testkey":"testValue"}
user = "myUser"
userPass = "password"
# Make the PUT request and print the results to the console
print system.net.httpPut(URL, params, username = user, password = userPass, contentType = "text/html")