# The `api/db/<dbname>/classes/<struct_no>/byindex/<index_no>/eq/<key>` Resource

> The `api/db/<dbname>/classes/<struct_no>/byindex/<index_no>/eq/<key>` resource executes the following operations for HTTP `GET`, `DELETE` and `PATCH`:

> - `GET`: Returns record(s) of the specified class using the index specified by `index_no`
> - `DELETE`: Deletes individual objects whose `index_no` matches the specified `key`
> - `PATCH`: Updates individual fields of the record identified by the `key` value.

> ### For an overview see page eXtremeDB Web Service Resources

> ## For classes with an `autoid`

> The `/api/db/<dbname>/classes/<struct_no>/byautoid` is provided for classes with an `autoid` defined. This is a shorthand for `"/api/db/<dbname>/classes/<struct_no>/byindex/<autoid_index_no>`"; i.e. it behaves as if the `byautoid` part of the path was rewritten with `byindex/<autoid_index_no>`. That is, the server finds the `autoid` index and inserts its identifier in the `byindex/...` requests. It works like this:

> - `byautoid/list` is handled as if it was `byindex/<autoid_index_no>/list`
> - `byautoid/eq/<key>` is handled as if it was `byindex/<autoid_index_no>/eq/<key>`.

> (The same methods are supported as for the `/list` and `/eq/<key>` resources)

> # GET

> The `GET` request returns record(s) of the specified class using the index specified by `index_no`. This endpoint supports the same query parameters as the `index_no list` request and returns record data in the same JSON format. (Please see page `api/db/<dbname>/classes/<struct_no>/byindex/<index_no>/list` for details.)

> Note that only integer, non-compound keys are supported currently.

> The following request would retrieve up to 5 records whose index 2 `key` is equal to `42`:

>         GET http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42?count=5

> # DELETE

> The `DELETE` request deletes individual objects whose `index_no` matches the `key` value.

> 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/42

> # PATCH

> The `PATCH` request updates individual fields of a record identified by the `key` value.

> 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 `i` and a string field `s` of 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 `PATCH` request are not affected. Fields must be explicitly reset to `null` if needed. For example:

>         PATCH http://localhost:8083/api/db/xsqldb/classes/3/byindex/2/eq/42
>         {
>             "record":
>             {
>                 "s": null
>             }
>         }