Metadata service
1. Introduction
The current version of the OpenSocial Specification documents a limited metadata service -- you can ask the OpenSocial server what fields are supported by a particular service. This is partly useful, but a more complete metadata service would enable apps to provide a more compelling user experience, as well as adapt to differences in Jive instances due to configuration choices.
2. Data Models
2.1 Field Metadata
Each FieldMetadata instance represents a field that may be present in a particular entity of the containing object type.
Field NameTypeDescription| array | Boolean | Flag indicating whether this field is an array (true) or scalar (false). |
availability | String | Description of conditions on when this field will be available for a particular object. |
description | String | Description of this field. |
editable | Boolean | Flag indicating whether this field is modifiable on create and update operations. |
name | String | Name of the key under which this field will be present. |
required | Boolean | Flag indicating whether this field is required on create and update operations. |
since | String | Jive Core API version in which this field is initially available. |
type | String | Object type of this field. |
2.2 Object Metadata
Each ObjectMetadata instance represents all of the metadata associated with a particular object type.
Field NameTypeDescription| availability | String | Description of conditions on when this object will be available. |
description | String | Description of this object type. |
fields | FieldMetadata[] | Description of all possible fields that may appear in this object. |
name | String | Formal name of this object type. |
resourceLinks | ResourceMetadata[] | Description of all possible resource links that may appear in this object. |
since | String | Jive Core API version in which this object is initially available. |
2.3 Property Metadata
Each PropertyMetadata instance represents a configuration value for this Jive Instance.
Field NameTypeDescription| description | String | Description of this property value |
name | String | Name of this property value |
type | String | Object type of this property value |
value | Object | The current value of this property |
3. REST APIs
Verb and Request URIResponse BodyDescription| GET /metadata/objects | Map<ObjectTypeName,MetadataURI> | Return a JSON object whose keys are all supported object types in this Jive instance, and whose values are the URI to retrieve the detailed metadata for that object type. |
GET /metadata/objects/ Unknown macro: {objectName} | ObjectMetadata | Return the object metadata for the specified object name. |
GET /metadata/properties | PropertyMetadata[] | Return all of the configuration properties for this server instance. |
4. JS APIs
These will match the OS standard JS pattern.
Certainly interesting and at first blush a definite improvement over the existing model. One possible alternative approach is to leverage the existing OPTIONS HTTP method on a resource to accomplish the same basic task. For instance, if I did...
OPTIONS /api/people/@me HTTP/1.1The server could respond with complete information about that particular resource (I'm throwing in a few additional bits of info just for illustration)
HTTP/1.1 200 OK Allow: GET, POST, PUT, DELETE, PATCH Allow-Patch: application/json+patch Content-Type: application/vnd.opensocial-resource-desc+json Link: <@me/@self>; rel="profile", <@me/@summary>; rel="summary", ... { "objectType": "person", "displayName": "Person Object", "id": "snx:profile", "fields": [ {...} ], "otherstuff": { ... } }Given any resource, then, we can identify exactly the kinds of things that can be done with it.
This could even work for the /metadata/properties piece by having an OPTIONS request to the base URI of the OS instance return the configuration properties in the body of the response...
OPTIONS /api HTTP/1.1...
HTTP/1.1 200 OK Allow: GET Content-Type: application/vnd.opensocial-resource-desc+json { "objectType": "service", "displayName": "My OpenSocial Service", "id": "snx:abc123", "config-property-1": "...", "config-property-2": "..." }