Get the current number of objects in an areas

GET/homes/{homeId}/smartModules/{moduleId}/collections/{collectionId}/data/count

Base URL: https://api.tinkermode.com

Get the current number of objects in an area by collection ID. Use the begin and end parameters to specify the time range to filter target objects. Do not count the objects outside of this period. The counter values are calculated for each value specified for the areaIds parameter. areaIds, floorId, and searchKeyPrefixes are optional parameters to filter the target objects.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain a user, service account, or project API key.

Path parameters

NameTypeRequiredConstraintsDescription
homeIdintegerYesThe unique ID for a home.
moduleIdstringYesThe unique ID for a smart module.
collectionIdstringYesCollection ID. It must be unique per home.

Query parameters

NameTypeRequiredConstraintsDescription
areaIdsstringNoSpecify area IDs to count the number of objects in the specified areas from the GeoTSDB storage. The areaIds parameter allows multiple values, separated by commas (","). The counter values are calculated for each value specified for areaIds parameter.
attributeQuerystringNoA filter string starting with a conjunction. Supported conjunctions are AND() and OR(). A conjunction takes a comma-separated condition string like AND (group==="group_1",maxSpeed<5). Each condition string defines a filter for the attribute value. The left-hand side must be a valid attribute field name. The right-hand side must be a value condition. For example, group==="group_1" matches any records where the group attribute value exactly matches "group_1". Supported operators are following | Operator | | | --- | --- | | === | exact match | | == | substring match | | ~== | included in array as exact match. name~==["john"|"jeff"|"jack"] matches one of the three. | | ~= | included in array as substring match. name~=["j"|"e"] matches "john", "jeff", "jack", and "ethan". | | < | less than | | <= | less than or equal to | | > | greater than | | >= | greater than or equal to |
beginstringNoThe beginning time of the data entries. The format follows RFC3339.
endstringNoThe end time of the data entries. The format follows RFC3339.
floorIdintegerNoSpecify floor ID to search target objects to count the number of objects in the area.
searchKeyPrefixesstringNoA comma-delimited list of search keys. If you specify searchKeyPrefixes, the system will retrieve all location data that has a searchKey beginning with this prefix. For example, if you specify searchKeyPrefixes as "foo::", objects with searchKey such as "foo::bar" and "foo::bazz" will be returned.

Responses

200 The requested counted data entries are returned.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
collectionIdstringYesread-only (server-generated)Identifier of the GeoTSDB collection.
dataarray<object>Yesread-only (server-generated)The array of count data per area.
Properties of data
PropertyTypeRequiredConstraintsDescription
areaIdstringNoread-only (server-generated)The area ID of the count data.
countnumberNoread-only (server-generated)The the number of object in the area.
timestampstringYesread-only (server-generated)Time in RFC3339 format.

Response example

{
  "collectionId": "california",
  "data": [
    {
      "areaId": "sfo_office",
      "count": 32
    }
  ],
  "timestamp": "2023-03-25T09:00:00+09:00"
}

401 Authorization is required to access this resource.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

404 Any requested object counted data entries are not found.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.