You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

PUT()

Usage

PUT(url, body, contentType, charset)
PUT(url, body, contentType)
PUT(url, body)

Description
Send an HTTP PUT request with the given body to the given url. This method can be used to make HTTP requests from within the Structr Server, triggered by a frontend control like a button etc.

The PUT() method will return a response object with the following structure:

Field Description Type
status HTTP status of the request Integer
headers Response headers Map
body Response body Map or String

If the MIME type of the response is application/json, the body field will contain the mapped response as a Structr object that can be accessed using the dot notation (e.g. result.body.result_count). Otherwise, the body field will contain the response as a string. (see the related articles for more information)

Note
Please note that the PUT() method will not be executed in the security context of the current user. The request will be made by the Structr server, without any user authentication or additional information. If you want to access external protected resources, you will need to authenticate the request using add_header().

Example

${PUT('http://localhost:8082/structr/rest/User/6aa10d68569d45beb384b42a1fc78c50', '{name: Tester}')}

results in

{body={code=401.0, message=Forbidden}, status=401, headers={Date=Tue, 22 Dec 2015 16:39:20 GMT, Content-Type=application/json; charset=utf-8, Content-Length=44, Server=Jetty(9.2.9.v20150224)}}

Search results for "PUT()"

PUT()

Send an HTTP PUT request with the given body to the given url. This method can be used to make HTTP requests from within the Structr Server, triggered by a frontend control like a button etc.

The PUT() method will return a response object with the following structure:

Field Description Type
status HTTP status of the request Integer
headers Response headers Map
body Response body Map or String
PUT(url, body [, contentType = 'application/json' [, charset = 'utf-8' ]] )

application_store_put()

Stores a value in the application level store.

application_store_put(key, value)

request_store_put()

Stores a value in the request level store.

request_store_put(key, value)