api/db/<dbname>/classes/<struct_no>/byindex/<index_no>/eq/<key> ResourceThe
api/db/<dbname>/classes/<struct_no>/byindex/<index_no>/eq/<key>resource executes the following operations for HTTPGET,DELETEandPATCH:
GET: Returns record(s) of the specified class using the index specified byindex_noDELETE: Deletes individual objects whoseindex_nomatches the specifiedkeyPATCH: Updates individual fields of the record identified by thekeyvalue.For an overview see page eXtremeDB Web Service Resources
For classes with an
autoidThe
/api/db/<dbname>/classes/<struct_no>/byautoidis provided for classes with anautoiddefined. This is a shorthand for"/api/db/<dbname>/classes/<struct_no>/byindex/<autoid_index_no>"; i.e. it behaves as if thebyautoidpart of the path was rewritten withbyindex/<autoid_index_no>. That is, the server finds theautoidindex and inserts its identifier in thebyindex/...requests. It works like this:
byautoid/listis handled as if it wasbyindex/<autoid_index_no>/listbyautoid/eq/<key>is handled as if it wasbyindex/<autoid_index_no>/eq/<key>.(The same methods are supported as for the
/listand/eq/<key>resources)GET
The
GETrequest returns record(s) of the specified class using the index specified byindex_no. This endpoint supports the same query parameters as theindex_no listrequest and returns record data in the same JSON format. (Please see pageapi/db/<dbname>/classes/<struct_no>/byindex/<index_no>/listfor details.)Note that only integer, non-compound keys are supported currently.
The following request would retrieve up to 5 records whose index 2
keyis equal to42:GET http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42?count=5DELETE
The
DELETErequest deletes individual objects whoseindex_nomatches thekeyvalue.For example the following request deletes the first record whose index 2 value is equal to
42:DELETE http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42PATCH
The
PATCHrequest updates individual fields of a record identified by thekeyvalue.WARNING: only one record is updated. If there are multiple records with the same key, which one gets updated depends on the index implementation. Thus, it is not recommended to use this method with non-unique indexes.
The request body is a JSON object. The fields to be updated are passed inside a single object,
"record", whose keys correspond to the records' field names.The format of the field data is the same as for the POST method of the
/api/db/<dbname>/classes/<struct_no>resource and the same restrictions apply.For example, an integer field
iand a string fieldsof a record could be updated with the following :PATCH http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42 { "record": { "i": 3, "s": "test" } }Note that any fields absent from the
PATCHrequest are not affected. Fields must be explicitly reset tonullif needed. For example:PATCH http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42 { "record": { "s": null } }