Class Web.Api.Api

Inheritance graph
Description

Base class for implementing a (RESTful) WebApi like Facebook's Graph API, Instagram's API, Twitter's API and so on.

Note: This class is useless in it self, and is intended to be inherited by classes implementing a given Web.Api.

Look at the code in Web.Api.Github, Web.Api.Instagram, Web.Api.Linkedin etc to see some examples of implementations.


Typedef Callback

typedef function(mixed, Protocols.HTTP.Query, mixed ... :void) Web.Api.Api.Callback

Description

Typedef for the async callback method signature.


Typedef Callback

typedef function(mixed, Protocols.HTTP.Query|Protocols.HTTP.Promise.Result, mixed ... :void) Web.Api.Api.Callback

Description

Typedef for the async callback method signature.


Typedef ParamsArg

typedef mapping|Web.Auth.Params Web.Api.Api.ParamsArg

Description

Typedef for a parameter argument


Constant ACCESS_TOKEN_PARAM_NAME

protected constant string Web.Api.Api.ACCESS_TOKEN_PARAM_NAME

Description

In some API's (LinkedIn f ex) this is named something else so it needs to be overridden i cases where it has a different name than the standard one.

Note

Obsolete.

This is only used if AUTHORIZATION_METHOD has been set to "".


Constant API_URI

constant string Web.Api.Api.API_URI

Description

The default URI to the remote API


Constant AUTHORIZATION_METHOD

protected constant string Web.Api.Api.AUTHORIZATION_METHOD

Description

Authorization header prefix.

This is typically "Bearer" as per RFC 6750, but some apis use the older "token".


Constant AuthClass

constant Web.Api.Api.AuthClass

Description

Authentication class to use


Constant DECODE_UTF8

protected constant int Web.Api.Api.DECODE_UTF8

Description

If 1 Standards.JSON.decode_utf8() will be used when JSON data is decoded.


Variable _auth

protected Web.Auth.OAuth2.Client Web.Api.Api._auth

Description

Authorization object.

See also

Web.Auth.OAuth2


Variable _query_objects

protected mapping(int:array(Protocols.HTTP.Query|Callback)) Web.Api.Api._query_objects

Description

The HTTP query objects when running async.


Variable auth

Web.Auth.OAuth2.Client Web.Api.Api.auth

Description

Getter for the authentication object. Most likely this will be a class derived from Web.Auth.OAuth2.Client.

See also

Web.Auth.OAuth2.Client or Web.Auth.OWeb.Auth.Client

Note

Read only


Variable http_request_timeout

int(0..) Web.Api.Api.http_request_timeout

Description

Request timeout in seconds. Only affects async queries.


Variable utf8_decode

bool Web.Api.Api.utf8_decode

Description

If 1 Standards.JSON.decode_utf8() will be used when JSON data is decoded.


Method create

Web.Api.Api Web.Api.Api(void|string client_id, void|string client_secret, void|string redirect_uri, void|string|array(string)|multiset(string) scope)

Description

Creates a new Api instance

Parameter client_id

The application ID

Parameter client_secret

The application secret

Parameter redirect_uri

Where the authorization page should redirect back to. This must be fully qualified domain name.

Parameter scope

Extended permissions to use for this authentication.