3.1 RPC Methods
The value of the "method" field in an OpenSocial RPC request uses a format of "<service-name>.<operation>". <service-name> is a string [A-Za-z0-9_]+ that identifies one of the services listed in [Services] and <operation> is a string [A-Za-z0-9_]+ that identifies an operation supported by that service.
All OpenSocial services MUST expose a "get" [TBD query, fetch are valid alternatives] operation. Operations with the names get, create, update and delete should map to the HTTP equivalent operations in the RESTful API of GET, PUT, POST & DELETE
3.2 Services
The names of the RPC services MUST match the names used in the OpenSocial namespace E.g http://ns.opensocial.org/messages/0.8
Containers MUST give access to the RPC services using a URL addressing scheme to invoke a single RPC via HTTP GET. This encoding can also be used to support RPC execution via form posts including file-uploads as parameters to RPCs. It is recommended that only services that are idempotent are exported in this manner. Containers MUST use the following canonical transformation between the RPC structure and its URL encoding
| Operation |
Parameters |
Return |
| get |
AuthToken auth = HttpRequest.Authorization, String or Array.<String> userId = "@me", String groupId = "@self", Array.<String> fields, int count, int startIndex, int startPage | opensocial.Person or Array.<opensocial.Person> |
| create | AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@friends", opensocial.Person person |
opensocial.Person |
| update | AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", opensocial.Person person | opensocial.Person |
| delete |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self" | Void |
8.1.1 get
Retrieve a single person or list of opensocial.Person objects. Supports returning a limited set of fields on returned Person objects and control of the order and paging in a returned list.
8.1.2 create
Support creating opensocial.Activity objects as the targets of a relationship with the specified user, this is a generalization of many use cases including invitation, contact creation etc. Implementation of this method is not required to be OpenSocial compliant
8.1.3 udpate
Support updating the properties of an opensocial.Person object identified by its relationship to the specified user.Implementation of this method is not required to be OpenSocial compliant
8.1.4 delete
Support removing the relationship between an opensocial.Person and the specified user. Implementation of this method is not required to be OpenSocial compliant
| Operation |
Parameters |
Return |
| get |
AuthToken auth = HttpRequest.Authorization, String or Array<String> userId = "@me", String groupId = "@self", String appId = auth.AppId, Array<String> activityIds = [], Array.<String> fields, int count, int startIndex, int startPage | opensocial.Activity or Array.<opensocial.Activity> |
| create |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", String appId = auth.AppId, opensocial.Activity activity | opensocial.Activity |
| update |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", String appId = auth.AppId, opensocial.Activity activity | opensocial.Activity |
| delete |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", String appId = auth.AppId, String activityId | Void |
8.2.1 get
Retrieve a one or list of opensocial.Activity objects. Supports returning a limited set of fields on returned Activity objects and control of the order and paging in a returned list.
8.2.2 create
Support creating opensocial.Activity objects as the targets of a relationship with the specified user, the specifically supported use case is posting a new activity to the stream of a single user i.e activity.create(userId="@me",groupId="@self", <some activity>) Support for other parameterizations is not required to be OpenSocial compliant.
8.2.3 udpate
Support updating opensocial.Activity objects as the targets of a relationship with the specified user. Implementation of this method is not required to be OpenSocial compliant
8.2.4 delete
Support removing the relationship between an opensocial.Activity and the specified user. Implementation of this method is not required to be OpenSocial compliant
| Operation |
Parameters |
Return |
| get |
AuthToken auth = HttpRequest.Authorization, String or Array.<String> userId = "@me", String groupId = "@self", String appId = auth.AppId, Array.<String> keys |
Map.<String, String> |
| update |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", String appId = auth.AppId, Map.<String, String> data |
Void |
| delete |
AuthToken auth = HttpRequest.Authorization, String userId = "@me", String groupId = "@self", String appId = auth.AppId, Array.<String> keys | Map.<String, String> |
8.3.1 get
Retrieve a map of key-value pairs for the list of specified keys.
8.3.2 udpate
Add or replace key-value pairs stored in a users appdata with the key-vaues in the data parameter.
8.3.3 delete
| Operation |
Parameters |
Return |
| send | AuthToken auth = HttpRequest.Authorization, String userId = "@me", opensocial.Message message | Void |
8.3.1 send
Send an opensocial.Message object to its defined recipients.
| Operation |
Parameters |
Return |
| listMethods | Array.<String> |
|
| methodSignatures |
String methodName |
Signature |
| methodHelp |
String methodName |
Content |
8.5.1 listMethods
Containers MUST imlpement this operation which takes no parameters and returns an array of all methods supported by the endpoint including the system methods. For a container which only supports read access to people & read and create access for activities the result would be
["people.get", "activities.get", "activities.create", "system.listMethods", "system.methodSignatures", "system.methodHelp"]
8.5.2 methodSignatures
Containers MUST implement this operation that returns a method signature describing the types of the parameters, their default values and the type of the return value for a given operation. Note that this scheme does not match that used for XML-RPC definition of method signatures which only specifies a mapping for positional parameters. Type definitions used here match the scheme used in the OpenSocial Javascript API. The example below is the Signature response for people.get
{
"return" : ["opensocial.Person", "Array.<opensocial.Person>"],
"auth" : {
"default" : null,
"type" : "AuthToken"
},
"userId" : {
"default" : "@me",
"type" : ["String", "Array.<String>"]
},
"groupId" : {
"default" : "@self",
"type" : "String"
},
"fields" : {
"default" : ["id","name","thumbnailUrl","profileUrl"],
"type" : "Array.<String>"
},
"count" : {
"type" : "int",
"required" : false
},
"startIndex" : {
"type" : "int",
"required" : false
}
"startPage" : {
"type" : "int",
"required" : false
}
}
The "return" field indicates the type of the result. If the service can return more than one type then the value is an array of the possible return types. Each named field in the response maps to a parameter of the operation and contains information about the types and values accepted for that parameter. The existence of "default" in the parameter detail indicates the parameter has a default value. The value of a default may be null which means that its not introspectable and usually means that it is some complex derivation. Parameters are assumed to be required unless otherwise indicated by the existence of the "required" field with a value of false.
8.5.3 methodHelp
Containers MAY implement this operation that returns a textual description of the operation identified by the methodName parameter. A container can choose to return either plaintext or HTML as the response.
| Code |
Meaning |
| -32700 (Parse error) |
Invalid JSON. An error occurred on the server while parsing the JSON text. |
| -32600 (Invalid Request) |
The received JSON not a valid JSON-RPC or batch of JSON-RPCs |
| -32601 (Method not found) | The requested remote-procedure does not exist / is not available. |
| -32602 (Invalid params) |
Invalid method parameters. |
| -32603 (Internal server error) |
Internal server error |
| -32099..-32000 | Reserved for implementation-defined server-errors. |
| 401 (Unauthorized) |
Access token does not grant access to the resource |
| 404 (Not Found) |
The requested resource was not found |
| 409 (Conflict) |
The requested update conflicts with a prior change |
| 0-1000 |
Reserved for future use by this specification |