GET(url, contentType, selector)
GET(url, contentType)

Sends an HTTP GET request with the given body and an optional content type 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 optional selector parameter can be used to select a subset of the HTML response, as documented in the JSOUP Cookbook.

The GET() method will return the literal HTTP response without the headers. If you are interested in the response headers, use the HEAD() function.

Please note that the GET() 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(). (see the related articles for more information)



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)}}


About this article
Last change 2018-01-30
Topics FrontendFunctionsStructr 2.0