API Docs for: 0.9.0
Show:

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.

Methods

_doRequest

(
  • url
  • config
  • callback
)
private

Calls IO. Provides mockability

Parameters:

  • url Object
  • config Object

    the IO configuration

  • callback Object

_makeRequest

(
  • method
  • url
  • params
  • config
  • callback
)
private

Creates the configuration to be passed to the IO request

Parameters:

  • method String

    HTTP method

  • url String

    HTTP location

  • params Object

    Params that are passed in the request

  • config Object

    Additional configuration

    • headers Object

      Headers to be sent with the request

    • timeout Number

      Timeout for the IO request

  • callback Function

    The handler for the response

DELETE

(
  • url
  • params
  • config
  • callback
)

Makes a RESTful DELETE request to specified URL

Parameters:

  • url String

    RESTful URL to hit.

  • params Object

    parameters to add to the request.

  • config Object

    may contain 'headers' or 'timeout' values.

  • callback Function

    called with response or error.

GET

(
  • url
  • params
  • config
  • callback
)

Makes a RESTful GET request to specified URL

Parameters:

  • url String

    RESTful URL to hit.

  • params Object

    parameters to add to the request.

  • config Object

    may contain 'headers' or 'timeout' values.

  • callback Function

    called with response or error.

HEAD

(
  • url
  • params
  • config
  • callback
)

Makes a RESTful HEAD request to specified URL

Parameters:

  • url String

    RESTful URL to hit.

  • params Object

    parameters to add to the request.

  • config Object

    may contain 'headers' or 'timeout' values.

  • callback Function

    called with response or error.

POST

(
  • url
  • params
  • config
  • callback
)

Makes a RESTful POST request to specified URL

Parameters:

  • url String

    RESTful URL to hit.

  • params Object

    parameters to add to the request.

  • config Object

    may contain 'headers' or 'timeout' values.

  • callback Function

    called with response or error.

PUT

(
  • url
  • params
  • config
  • callback
)

Makes a RESTful PUT request to specified URL

Parameters:

  • url String

    RESTful URL to hit.

  • params Object

    parameters to add to the request.

  • config Object

    may contain 'headers' or 'timeout' values.

  • callback Function

    called with response or error.