The OpenSocial specification is rather vague about what the specifics of the metadata call, the following was obtained by reverse engineering Shindig (version: 12/08 snapshot build)
Inputs:
- URL: <gadget-server>/gadgets/metadata
- GET Not Supported
- POST
- Content
- Must be JSON
- context :
- view : (optional) string
- ignoreCache : (optional) boolean (default false)
- container : (optional) string
- debug : (optional) boolean (default false)
- gadgets : array of gadget
- gadget :
- url : string
- moduleId : (optional) integer
- prefs : (optional) map<String,String> - these preferences are used to perform hangman substitution and for creating the iframeUrl.
- language & country : (optional) strings - combination of language and country is used for java.util.Locale
- gadget :
- context :
- Must be JSON
- Response (200)
- Header
- Content-Type: application/json; charset=utf-8
- Content-Disposition: attachment;filename=rpc.txt
- Content
- gadgets : array of gadget or gadget-error
- gadget
- features : array<String>
- iframeUrl : string
- links : map<String(rel), String(href)>
- moduleId : integer
- title : string
- titleUrl : string
- url : string
- userPrefs : map<String(pref-name), pref> - these are the declared preferences from the Gadget XML
- pref :
- displayName : string
- type : string
- default : string
- enumValues : map<String(value), String(display-value)>
- orderedEnumValues : array of JSON objects (???)
- pref :
- views : map<String(view-name), view>
- view :
- type : string
- quirks : boolean
- preferredHeight : integer
- preferredWidth : integer
- view :
- directoryTitle : string
- thumbnail : string
- screenshot : string
- author : string
- authorEmail : string
- authorAffiliation : string
- authorLocation : string
- authorPhoto : URI
- authorAboutme : string
- authorQuote : string
- authorLink : URI
- categories : array<String>
- screenshot : string
- height : integer
- width : integer
- showStats : boolean
- showInDirectory : boolean
- singleton : boolean
- scaling : boolean
- scrolling : boolean
- gadget-error
- url
- moduleId
- errors : error message
- gadget
- gadgets : array of gadget or gadget-error
- Header
- Response BAD_REQUEST (400)
- Maybe see server log
- Maybe see content of the response
- Response SC_INTERNAL_SERVER_ERROR(500)
- See server log
- See content of response
- Content
Sample JSON Request
{
"context":{"country":"US","language":"en","view":"default","container":"default"},
"gadgets":[
{"url":"http://www.google.com/ig/modules/hello.xml","moduleId":1}
]
}
Sample JSON Response
{
"gadgets": [
{"features":[],
"categories":["",""],
"links":{},
"title":"hello world example",
"titleUrl":"",
"scrolling":false,
"url":"http://www.google.com/ig/modules/hello.xml",
"views":{
"default":{
"type":"html",
"preferredHeight":0,
"preferredWidth":0,"quirks":true
}
},
"thumbnail":"",
"singleton":false,
"showInDirectory":false,
"iframeUrl":"/gadgets/ifr?container=default&mid=1&v=db18c863f15d5d1e758a91f2a44881b4&lang=en&country=US&view=default&url=http%3A%2F%2Fwww.google.com%2Fig%2Fmodules%2Fhello.xml",
"scaling":false,
"height":0,
"moduleId":1,
"authorPhoto":"",
"width":0,
"screenshot":"",
"userPrefs":{},
"authorLink":"",
"showStats":false
}
]
}