OpenSocial Pages supports the following OpenSocial Core Gadget Specification 1.0.
The root node of a gadget XML specification is the Module element.
Serves as a container element for all Metadata, Features, and processing rules. For nested element descriptions, see their individual sections of this document.
Declares Feature dependencies of the gadget.
Deprecated. Use /ModulePrefs/Link/@rel="icon" (Section 188.8.131.52.1)instead.
Provides localization information. Containers MUST honor localization rules as specified in Localization (Section 9). Each Locale tag represents localization information for a single locale.
A single localized value, keyed by @name, with the value coming from text().
Gadgets MAY specify any number of /ModulePrefs/Link (Section 184.108.40.206)elements, which the Container SHOULD process according to rules specific to the value of /ModulePrefs/Link/@rel. Containers MAY support additional links, but they should pick an appropriate namespace for the rel attribute so as to not conflict with the standard. Containers MUST NOT support non-standard rel attributes with any of the following prefixes: "opensocial", "gadgets", or "events".
A User Preference specification.
A single value that serves as a constraint on User Preferences when /UserPref/@datatype is "enum". Containers SHOULD use EnumValue elements to present Users with a menu when rendering a preferences interface. For details on handling enum preferences, see User Preferences (Section 4.1.2).
Contains the run time portion of the gadget.
Variables may be substituted into a gadget by replacing special variable tokens with an appropriate value defined elsewhere in the spec. Tokens take the form __<TYPE>_<key>__. For all substitutions, the full token is to be replaced by a value for the following values of <TYPE>:
Containers MUST perform substitution on all elements and attributes defined in Elements and Attributes (Section 4), with the exceptions of /ModulePrefs/Locale (and children), or any element with an explicit enumeration. Containers SHOULD perform substitution on any custom elements or fields that they support.
Containers MUST perform MSG substitutions in the order listed above. Containers MUST substitute BIDI, MODULE, and UP tokens after substituting MSG values, but they MUST NOT recursively substitute any other tokens.
Localization of a gadget is achieved primarily through Variable Substitution (Section 8), using the MSG token.
To determine appropriate keys and values for substitution, Containers MUST select an appropriate /ModulePrefs/Locale based on the following rules:
Containers MAY provide their own translations or use a third-party translation service if there is no appropriate Locale defined in the gadget.
After selecting a Locale, Containers MUST replace all MSG tokens by using /ModulePrefs/Locale/msg/@name for keys and /ModulePrefs/Locale/msg/text() for values.
Containers MUST perform BIDI token substitution with the following values if /ModulePrefs/Locale/@language_direction is "rtl":
required by the libraries if an application includes <Require
feature="osapi"/> in the ModulePrefs section of the gadget XML file.
Sends a request to execute a request to a service method. Generally invoked as <service-name>.<method-name>(params).execute(callback) to send a request to the given method (<method-name>) on the specified service (<service-name>). Takes a callback for response processing.
Multiple service requests can be combined into a single batch request using the following methods:
Creates a new batch request.
osapi.BatchRequest osapi.add(key, request)
Adds a service request to the batch associated with the specified key. A single batch request can contain both JSON-RPC calls (e.g. osapi.people.get()) and HTTP calls to third parties (e.g. osapi.http.get()).
Executes all of the requests in the batch. Takes a callback for response processing, which is passed a JSON object mapping each request key to a JSON response object.
Service object for making HTTP requests to third party servers. This is not a JSON-RPC endpoint, but a third party web service. The object created by methods (e.g. get(), post()) is an osapi.Request object, suitable for immediate execution with osapi.Request.execute or batch operations with osapi.BatchRequest.
<static> osapi.Request osapi.http.head(params)
Creates a HEAD request to an arbitrary URL.
<static> osapi.Request osapi.http.get(params)
Creates a GET request to an arbitrary URL.
<static> osapi.Request osapi.http.post(params)
Creates a POST request to an arbitrary URL.
<static> osapi.Request osapi.http.put(params)
Creates a PUT request to an arbitrary URL.
<static> osapi.Request osapi.http.delete(params)
Creates a DELETE request to an arbitrary URL.
OpenSocial 1.0 >