Y.mojito.lib.REST Class
The Rest module for Mojito provides an easy way to make RESTful calls to URLs without messing about with Y.io.
Item Index
Methods
Methods
_doRequest
-
url -
config -
callback
Calls IO. Provides mockability
Parameters:
-
urlObject -
configObjectthe IO configuration
-
callbackObject
_makeRequest
-
method -
url -
params -
config -
callback
Creates the configuration to be passed to the IO request
Parameters:
-
methodStringHTTP method
-
urlStringHTTP location
-
paramsObjectParams that are passed in the request
-
configObjectAdditional configuration
-
headersObjectHeaders to be sent with the request
-
timeoutNumberTimeout for the IO request
-
-
callbackFunctionThe handler for the response
DELETE
-
url -
params -
config -
callback
Makes a RESTful DELETE request to specified URL
Parameters:
-
urlStringRESTful URL to hit.
-
paramsObjectparameters to add to the request.
-
configObjectmay contain 'headers' or 'timeout' values.
-
callbackFunctioncalled with response or error.
GET
-
url -
params -
config -
callback
Makes a RESTful GET request to specified URL
Parameters:
-
urlStringRESTful URL to hit.
-
paramsObjectparameters to add to the request.
-
configObjectmay contain 'headers' or 'timeout' values.
-
callbackFunctioncalled with response or error.
HEAD
-
url -
params -
config -
callback
Makes a RESTful HEAD request to specified URL
Parameters:
-
urlStringRESTful URL to hit.
-
paramsObjectparameters to add to the request.
-
configObjectmay contain 'headers' or 'timeout' values.
-
callbackFunctioncalled with response or error.
POST
-
url -
params -
config -
callback
Makes a RESTful POST request to specified URL
Parameters:
-
urlStringRESTful URL to hit.
-
paramsObjectparameters to add to the request.
-
configObjectmay contain 'headers' or 'timeout' values.
-
callbackFunctioncalled with response or error.
PUT
-
url -
params -
config -
callback
Makes a RESTful PUT request to specified URL
Parameters:
-
urlStringRESTful URL to hit.
-
paramsObjectparameters to add to the request.
-
configObjectmay contain 'headers' or 'timeout' values.
-
callbackFunctioncalled with response or error.
