Question: I am trying to figure out how to use the ExactTarget SOAP API to retrieve the number of records in a [DataExtensionObject](http://help.exacttarget.com/en/technical_library/web_service_guide/objects/dataextensionobject/) for a given DataExtensionObject key, for example:

```
 <ObjectType>DataExtensionObject[SampleDataExtensionKey]</ObjectType>

```

I don't need to retrieve all fields from the data extension (I'm already doing this), I just want to count the number of records/rows. Does anyone know how to do this?

Answer: 
You can retrieve rows count using an undocumented REST endpoint:

```
GET https://YOUR-HOST.rest.marketingcloudapis.com/data/v1/customobjectdata/key/<DE-KEY>/rowset?$page=1&$pagesize=1

```

```json
{
  "links": {
    "self": "/v1/customobjectdata/token/100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7/rowset?$page=1",
    "next": "/v1/customobjectdata/token/100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7/rowset?$page=2"
  },
  "requestToken": "100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7",
  "tokenExpireDateUtc": "2020-10-09T12:44:32.51",
  "customObjectId": "<DE-ID>",
  "customObjectKey": "<DE-KEY>",
  "pageSize": 1,
  "page": 1,
  "count": 636,
  "items": [
    {
      "keys": {
        "email": "foo@bar.net"
      },
      "values": {
        "client_id": "ABCDEFGHUJKLMNOPQ",
        "country": "",
        "foo": "",
        "bar": ""
      }
    }
  ]
}

```
I actually just went through this - and unfortunately, there isn't a direct way to get a record count. 

*However - there is a workaround*

You can create a QueryActivity and create a counts data extensions using a query similar to this - 

```
"SELECT COUNT(YOUR_DE.Email) as Count, "Emails" as DE_NAME FROM YOUR_DE"

```

The QueryActivity would point at your counts de with two columns `count` and `DE_NAME`. You can then hook up multiple queries in one shot and get a count of all your tables. You would then retrieve the data in the count table (after running the query) and determine the number of records.

This is in no way ideal, however it's currently the best approach I can see until we have the routes built out for it.