Find

List records from specified collection

Finds database records. You can pass projection to return record fields you care about. Also, you can include referenced collections to have all that information in one place.

[Find] - List records from specified collection

get

Finds database records. You can pass projection to return record fields you care about. Also, you can include referenced collections to have all that information in one place. https://docs.codemash.io/api/database/collections/find

Authorizations
Path parameters
CollectionNamestringRequired

Collection name - unique, lowercased, collection name without whitespace. E.g., if your collection title you have entered in the CodeMash dashboard is "Business Trips" then collection name would be "business-trips".

versionstringRequired

The CodeMash API version used to fetch data from the API. If not specified, the last version will be used. E.g.: v2

Query parameters
IncludeSchemabooleanOptional

Use the IncludeSchema property when you want to have schema definition in the API response as well. This is useful when you have dynamic data rendering and want to have context over your data structure and how it should be displayed. By default schema is excluded.

IncludeUserNamesbooleanOptional

If your collection record has relationship with the Users collection from the Membership module, you can set IncludeUserNames property to "true" to get full user name and id information altogether without making any extra roundtrip to the server.

IncludeRoleNamesbooleanOptional

If your collection record has relationship with the system Roles from the Membership module, you can set IncludeRoleNames property to "true" to get full role name and id information altogether without making any extra roundtrip to the server.

IncludeCollectionNamesbooleanOptional

If your collection record has relationship with other collections from the Database module, you can set IncludeCollectionNames property to "true" to get display name and id information altogether without making any extra roundtrip to the server.

IncludeTermNamesbooleanOptional

If your collection record has relationship with the taxonomy terms from the Database module, you can set IncludeTermNames property to "true" to get term name and id information altogether without making any extra roundtrip to the server.

ExcludeCulturebooleanOptional

Set ExcludeCulture property to "true" when you want to return all the data translations from translatable fields. This is useful when you want to take care about translations in the front-end side. E.g.: when you want to enter product description in your project supported languages.

AddReferencesFirstbooleanOptional

If true, then references are injected before your list queries are applied

PageSizeinteger · int32Optional

Amount of records to return

PageNumberinteger · int32Optional

Page of records to return

SortstringOptional

A query that specifies how to sort filtered records

Header parameters
AcceptanyRequired

Accept Header

X-CM-ClusterstringOptional

API key of your cluster. Can be passed in a header as X-CM-Cluster.

X-CM-ProjectIdstringRequired

ID of your project. Can be passed in a header as X-CM-ProjectId.

CultureCodestringOptional

Specify culture code when your response from the API should be localised. E.g.: en

Responses
200
Success
application/json
get
GET //{version}/db/{CollectionName}/find HTTP/1.1
Host: api.codemash.io
Authorization: YOUR_API_KEY
X-CM-ProjectId: text
Accept: */*
200

Success

{
  "total_count": 1,
  "schema": {
    "collection_name_as_title": "text",
    "collection_name": "text",
    "ui_schema": "text",
    "json_schema": "text",
    "translatable_fields": [
      "text"
    ],
    "database_id": "text",
    "schema_id": "text"
  },
  "response_status": {
    "error_code": "text",
    "message": "text",
    "stack_trace": "text",
    "errors": [
      {
        "error_code": "text",
        "field_name": "text",
        "message": "text",
        "meta": {
          "ANY_ADDITIONAL_PROPERTY": "text"
        }
      }
    ],
    "meta": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    }
  },
  "result": "text"
}

[Find] - List records from specified collection

post

Finds database records. You can pass projection to return record fields you care about. Also, you can include referenced collections to have all that information in one place. https://docs.codemash.io/api/database/collections/find

Authorizations
Path parameters
CollectionNamestringRequired

Collection name - unique, lowercased, collection name without whitespace. E.g., if your collection title you have entered in the CodeMash dashboard is "Business Trips" then collection name would be "business-trips".

versionstringRequired

The CodeMash API version used to fetch data from the API. If not specified, the last version will be used. E.g.: v2

Query parameters
IncludeTermNamesbooleanOptional

If your collection record has relationship with the taxonomy terms from the Database module, you can set IncludeTermNames property to "true" to get term name and id information altogether without making any extra roundtrip to the server.

AddReferencesFirstbooleanOptional

If true, then references are injected before your list queries are applied

Header parameters
AcceptanyRequired

Accept Header

X-CM-ClusterstringOptional

API key of your cluster. Can be passed in a header as X-CM-Cluster.

X-CM-ProjectIdstringRequired

ID of your project. Can be passed in a header as X-CM-ProjectId.

CultureCodestringOptional

Specify culture code when your response from the API should be localised. E.g.: en

Body
anyOptional
Responses
200
Success
application/json
post
POST //{version}/db/{CollectionName}/find HTTP/1.1
Host: api.codemash.io
Authorization: YOUR_API_KEY
X-CM-ProjectId: text
Content-Type: application/json
Accept: */*
200

Success

{
  "total_count": 1,
  "schema": {
    "collection_name_as_title": "text",
    "collection_name": "text",
    "ui_schema": "text",
    "json_schema": "text",
    "translatable_fields": [
      "text"
    ],
    "database_id": "text",
    "schema_id": "text"
  },
  "response_status": {
    "error_code": "text",
    "message": "text",
    "stack_trace": "text",
    "errors": [
      {
        "error_code": "text",
        "field_name": "text",
        "message": "text",
        "meta": {
          "ANY_ADDITIONAL_PROPERTY": "text"
        }
      }
    ],
    "meta": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    }
  },
  "result": "text"
}

GET - Gets all records from Collection "Companies."

curl --location --request GET 'https://api.codemash.io/v2/db/companies/find' \
--header 'X-CM-ProjectId: 7254937f-ad77-4d00-9b35-c2af7841d21b' \
--header 'Authorization: Bearer ebis52*******yUfrX'

POST - Gets all records from Collection "Companies" where company code is equal to "123"

curl --location --request POST 'https://api.codemash.io/v2/db/companies/find' \
--header 'X-CM-ProjectId: 7254937f-ad77-4d00-9b35-c2af7841d21b' \
--header 'Authorization: Bearer ebis52*******yUfrX' \
--header 'Content-Type: application/json' \
--data-raw '{ "filter": "{ code: 123 }"}'

Check the docs on how to form projections, filters, sorting, paging. Check the docs on how to use references.

Last updated

Was this helpful?