Objectivity REST : Query Resources : POST /v1/query
POST /v1/query
POST /v1/query
Performs queries and creates or updates data using the declarative Objectivity (DO) language.
Headers 
 
Response Format
Accept:application/json
Body format
Content-Type:application/json
URL Parameters 
fdAlias
Provides the alias of a federated database that is included in the REST server’s configuration file; see Configuring the REST Server in Objectivity/DB Administration.
Body Parameters 
query
DO statement to execute.
language
Chooses the database language to use. Currently, only do is available, but other languages can be added in the future.
Discussion 
DO is a database language that supports queries, updates, and data ingest. For complete information about DO, refer to Declarative Objectivity (DO) Language.
Sample Body 
The following example returns representations of all Vehicle objects:
{  
  "query": "FROM FleetData.Vehicle RETURN *;",
  "language": "do"
}
Curl Example 
curl -X POST -H "Content-Type:application/json,Accept:application/json" -d "{\"query\":\"FROM FleetData.Vehicle RETURN *;\",\"language\":\"do\"}" localhost:8185/v1/query
Response 
The response shows the OID and attributes for each Vehicle.
Status: 200 OK
[
  {
    "__class__": "FleetData.Vehicle",
    "__identifier__":"3-3-1-9",
    "available":false,
    "retired":false,
    "license":"XLT5663",
    "servRecs":[],
    "currentRental":"0-0-0-0",
    "pastRentals":[],
    "model":"0-0-0-0",
    "atStall":"0-0-0-0"
  },
...
]
More Samples 
The following returns representations of all Vehicle objects with the given license value:
{
  "query": "FROM FleetData.Vehicle WHERE license == 'XLT5663' RETURN *;",
  "language": "do"
}
The following confirms that a Customer with the firstName Jack has a RentalContract with the trackingNumber of 122 among his list of rentals. The ANY operator returns true if any element in a collection qualifies according to the given predicate.
{
  "query": "FROM FleetData.Customer WHERE firstName='Jack' AND ANY(rentals, trackingNumber=122) RETURN *;",
  "language": "do"
}
The following queries for RentalContract objects with a referenced Customer object whose firstName is set to Tom. The dot operator (.) accesses the value of an attribute on a referenced class.
{
  "query": "FROM FleetData.RentalContract WHERE customer.firstName=='Tom' RETURN *;",
  "language": "do"
}
Creates a new Customer object with the given first and last name.
{  
  "query": "CREATE FleetData.Customer{firstName='Beth',lastName='Martin'};",
  "language": "do"
}
See also 
Declarative Objectivity (DO) Language
Type
objy ListOperators at a command prompt to get the complete list of DO operators.