GET request
The GET request is passed in the URL in location (see Symbol reference / location - HTTP URL).
location - is the part of URL after server and port specification. It defines an access path for the source property that addresses an elementary data item, an object instance (complex data type) or a collection or array of instances. When the source property is a collection or an array, all instances in the source property are returned in the response.
The source property may also refer to a function name, as long as the function called does not require parameters. In this case, the response contains the function result. Functions may be odaba::Property functions, but also OSI functions implemented in the class of preceding property's data type.
An error description is returned as JSON object (see Error handling) in case of key conflicts or other error(s) in the request definition.
// simple GET requests
// get all children of a person
http://127.0.0.1:8888/Person::Persons/ID123/children
// get person LOID
http://127.0.0.1:8888/Person::Persons/ID123/instanceLoid
// get number of employees for first company
http://127.0.0.1:8888/Company/0/employees/*/count
The GET request returns a JSON object (syntax of object and other syntax elements referenced here is described in chapter Symbol reference / Values, formats and encoding. In case of error, a string_value is returned containing an error message. The response for a successful GET request is a JSON object with one named_value:
{ name: values }
name - is the name of the source property in location. In case of elementary source property (elementary attribute, BLOB, MEMO), values is a value, i.e. a string, number or true or false.
In case of a collection source, values is an array.
{ name: [ object, ..., object ] }
When location refers to an instance, values is a single object.
{ name: { named_value, ..., named_value } }
Within returned objects, each name is a property name as defined for the complex data type of instance and all its base types.
values for collection properties within an object return an array of URL instances or an empty array, when the collection is empty:
name: [ { url: LOID/number },...,{ url: LOID/number } ]
name: [ ]
Array attributes within an object return a values array:
name: [ values,...,values ]
Complex data type attributes within an object return an object.
name: { named_value,...,named_value }
More details for values are described in Symbol reference / Values, formats and encoding.
// get number of employees for first company
http://127.0.0.1:8888/Company/0/employees/count returns:
{ count: 485 }
// Get person's children
http://127.0.0.1:1234/Persons/ID123/children returns:
{ children: [
{ pid: "ID123" name: "Miller", first_name_0: "Paul",
first_name: [ "Henry", "" ], birth_date: "1966-11-11", sex: "male", married: false,
income: 2500.00, age: 52, children_income: 3807.22,
notes: "this might be a very long text in C-string format\n",
address: [ { url: LOID/12346127 } ],
children: [
{ url: LOID/12346000 },
{ url: LOID/12346002 } ],
parents: [ { url: LOID/12346001 } ] ,
employee: [ ]
}, { ... next child instance .... }, ..., {...}
] }