Method Web.Api.Api()->call()


Method call

mixed call(string api_method, void|ParamsArg params, void|string http_method, void|string data, void|Callback cb, mixed ... rest)

Description

Calls a remote API method.

Throws

An exception is thrown if the response status code is other than 200, 301 or 302.

Parameter api_method

The remote API method to call! This should be a Fully Qualified Domain Name

Parameter params

Additional params to send in the request

Parameter http_method

HTTP method to use. GET is default

Parameter data

Inline data to send in a POST request for instance.

Parameter cb

Callback function to get into in async mode

Returns

If JSON is available the JSON response from servie will be decoded and returned. If not, the raw response (e.g a JSON string) will be returned. The exception to this is if the status code in the response is a 30x (a redirect), then the response headers mapping will be returned.