Data Manager API



Get Length by ViewId

Description

Retrieve the length of a given view ID based on specified options.

Request

  • HTTP Method: GET
  • Endpoint URL: dama[{keys:pgEnvs}].viewsbyId[{keys:viewIds}].options[{keys:options}].length
  • Parameters:
    • pgEnvs (path parameter): The environment key.
    • viewIds (path parameter): The ID of the view for which the length is to be retrieved.
    • options (path parameter): A JSON stringified object containing various options to filter, exclude, group, and order the data.

Options Format

The options parameter should be a JSON stringified object. Below is an example and description of its structure:

Example

JSON.stringify({
"aggregatedLen": true,
"filter": { "geoid": [36001, 36002], "status": ["active"] },
"exclude": { "year": [2011, 2012], "status": ["inactive"] },
"groupBy": ["geoid", "status"],
"orderBy": { "geoid": "desc", "status": "asc" },
"gt": {col1: 150000000, col2: 150000},
"gte": {col3: 150000000, col4: 150000},
"lt": {col5: 150000000, col6: 150000},
"lte": {col7: 150000000, col8: 150000},
"like": {"geoid": '36%'}
})



Options Details

  • aggregatedLen (boolean): Indicates if the result should consider aggregation. Set to true if groupBy is used.
  • filter (object): Specifies the filter conditions. Keys are column names, and values are arrays of acceptable values for those columns.
    • Example: "filter": { "geoid": [36001, 36002], "status": ["active"] }
  • exclude (object): Specifies the exclude conditions. Keys are column names, and values are arrays of values to be excluded from those columns.
    • Example: "exclude": { "year": [2011, 2012], "status": ["inactive"] }
  • gt/gte/lt/lte (object): Specifies the comparison conditions. Keys are column names, and values are numbers to be compared.
    • gt (Greater Than): Specifies that the value in the column must be greater than the specified number.
    • gte (Greater Than or Equal To): Specifies that the value in the column must be greater than or equal to the specified number.
    • lt (Less Than): Specifies that the value in the column must be less than the specified number.
    • lte (Less Than or Equal To): Specifies that the value in the column must be less than or equal to the specified number.
    • Example: "gt": { "loss": 15000 }
  • like (object): Specifies a pattern matching condition for filtering data based on string values. The keys represent column names, and the values are strings that may include wildcard characters for matching. It is expected that the % character will be included in the strings to denote wildcard matches.
    • %: Represents zero or more characters.
    • _: Represents a single character.
    • Example: jsonCopy code"like": { "name": "John%" }
  • groupBy (array): An array of column names or numbers to group the data by.
    • Example: "groupBy": ["geoid", "status"]
  • orderBy (object): Specifies the ordering of the results. Keys are column names, and values are the sort order ('asc' for ascending, 'desc' for descending).
    • Example: "orderBy": { "geoid": "desc", "status": "asc" }

Notes

  • Ensure the options parameter is properly JSON stringified before sending the request.
  • The aggregatedLen should be set to true if you are using the groupBy option to get the correct length considering the aggregation.

Get Attributes By ViewId


Description

Retrieve data for a given view ID based on specified options, indices, and attributes.


  • HTTP Method: GET
  • Endpoint URL: dama[{keys:pgEnvs}].viewsbyId[{keys:viewIds}].options[{keys:options}].databyIndex[{integers:indices}][{keys:attributes}]
  • Parameters:
    • pgEnvs (path parameter): The environment key.
    • viewIds (path parameter): The ID of the view for which the data is to be retrieved.
    • options (path parameter): A JSON stringified object containing various options to filter, exclude, group, and order the data.
    • indices (path parameter): An object specifying the range of indices in the form {from: x, to: y}.
    • attributes (path parameter): An array of column names for which the data is to be retrieved.

Indices Format

The indices parameter should specify the range of indices to retrieve. It is an object with from and to keys.

Example

{ "from": 0, "to": 10 }

Attributes Format

The attributes parameter should be an array of column names for which the data is to be retrieved.

Example

["geoid", "status", "year"]

Notes

  • Ensure the options parameter is properly JSON stringified before sending the request.
  • The indices parameter must specify a valid range in the form {from: x, to: y}.
  • The attributes parameter must be an array of valid column names.
  • For additional details about the options parameter and other shared information, refer to the "Get Length by View ID"