Search the API Reference:
Acre API Reference - acre
write
function(response_text)
-
Writes the given string to the HTTP response body.
-
response_text (string, required) - The text to write
exit
function()
-
Abruptly terminates the execution of the script.
require
function(url)
-
Loads the script with the given URL and returns the loaded script as an object.
-
url (string, required) - The URL of an Acre-hosted script, either absolute ("http://published-host.freebaseapps.com/foo"), relative to Acre ("//published-host/foo" or "//appY.userX.user.dev/foo"), or relative to the file ("foo").
route
function(url)
-
Routes the request to the given URL, but does not change the user-visible URL
-
url (string, required) - The Acre-hosted URL to route to... can include path and params.
get_metadata
function(url)
-
Returns the metadata for an app, including the list of files.
-
url (string, required) - The URL of an app
include
function(url)
-
Includes the output of a template inline. Currently, only works for templates.
-
url (string, required) - The URL of a template
urlfetch
function(url, options)
-
Fetches the given url using the given HTTP method, headers, and content as payload.
-
url (string, required) - A valid publicly accessible URL
-
options (obj, required) - The HTTP request options for an urlfetch.
-
method (string, optional) - An HTTP method, such as "GET" and "POST". Default is "GET".
-
headers (obj, optional) - A Javascript object containing key/value pairs, e.g., { "Content-Length" : 25 }
-
content (string, optional) - The body of the HTTP request, applicable for POST
-
sign (boolean, optional) - Whether or not Acre should try to 'sign' the request using OAuth credentials set by acre.oauth.get_credentials() [defaults to 'false']
-
timeout (number, optional) - (Async only). Number of ms to give the request before throwing (or calling errback with) a timeout error
version
string
-
Version of the Acre system
error
hash
-
The dictionary of properties of the error (only present when executing an error script).
form_url
function(base_url, url_parameters)
-
Deprecated, use acre.form.build_url
-
base_url (string, required) - the base URL
-
url_parameters (obj, required) - a javascript object
htmlencode
function(text)
-
Deprecated, use acre.form.encode
-
text (string, required) - some text to encode
formquote
function(string)
-
Deprecated, use acre.form.quote
-
string (string, required) - some text to decode
formencode
function(obj)
-
Deprecated, use acre.form.encode
-
obj (obj, required) - a javascript object to encode
formdecode
function(string)
-
Deprecated, use acre.form.decode
-
string (string, required) - a string to decode
start_response
function(status, headers)
-
Deprecated, use acre.response
-
status (number, optional) - the HTTP status code of the response.
-
headers (obj, optional) - the HTTP headers to set on the response.