# 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.

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

Constant API_URI

  `constant int Web.Api.Api.API_URI`

Description

  The URI to the remote API

Constant AuthClass

  `protected constant Web.Api.Api.AuthClass`

Description

  Authentication class to use

Typedef Callback

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

Description

  Typedef for the async callback method signature.

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.

Typedef ParamsArg

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

Description

  Typedef for a parameter argument

Variable _auth

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

Description

  Authorization object.

See also

  Web.Auth.OAuth2

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(string client_id, 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.