Table of Contents
Overview
OSRF methods can be called via HTTP as browser requests, returning JSON objects or XML documents. JSON is the default, though XML can also be specified. To use XML as the protocol for the request, an XML document must be POSTed; this will not be covered at this time.
Syntax for Calling OSRF Via Web Browser:
http://www.<base url>/gateway?format=<return format>&input_format=<input format>&service=<OSRF application name>&method=<Name of Registered OSRF Method>¶m=<param1 value>&…¶m=<param n value> for n parameters.
format and input_format are optional; if neither is present then the request will return a JSON object. To request an XML dococument, "format=XML" and "input_format=JSON" should be used. If the "input_format=JSON" parameter is not used with a request for an XML document (i.e., "format=XML", then the request will return an error.
The value for the service parameter is the name of the OpenSRF application; for example, open-ils.auth, open-ils.search, or open-ils.actor. The value for the method parameter, likewise, is the registered OSRF method to be called.
Order matters for the param parameters; they must be ordered as they are in the method declaration for the osrf application.
Examples:
Input Format and Return Format as JSON:
Both of these examples return the same values; the return and input types do not need to be explicitly stated when requesting JSON objects.
Implicit Defaults for Input/Return Type
list some examples
Explicit Declarations of Input/Return Type
list some examples
Return Format as XML
list some examples
Return Status
OSRF methods will return a status as part of the JSON object or XML document.
STatus | Error Message | Possible Cause |
---|---|---|
200 | The request is returned successfully; the payload contains the returned object. | |
404 | one of the error messages | explanation |
404 | Row 2 Col 2 | Row 2 Col 3 |
Insert examples (include method header from osrf, request to send to demo.gapines.org, and returned values)
Create table of Return Status
Put it in the real wiki!