Skip to content

Auto generated schema based DISTINCT WITH QUERY API

Table structure

customer_id first_name last_name last_update pincode isActive
1 Bob lin 2022-11-14 04: 34: 58 382345 1
2 Alice Page 2022-10-15 02: 10: 40 382346 1
3 Mallory Brown 2022-09-13 03: 44: 05 382347 1
4 Eve Mathly 2022-11-12 01: 59: 33 382348 1
5 Eve Page 2022-11-12 01: 59: 33 382349 1

Request Method: POST

Simple distinct by query

  • It will return distinct documents/rows where first_name equals "Mallo" in ascending order.

URL

/api/schema/user-path/instance/database/table/distinct/first_name/asc

Request payload

{
    "find": {
        "first_name": "Mallo"
    }
}

Blank find object

  • It will return distinct documents/rows, first_name in ascending order.
/api/schema/user-path/instance/database/table/distinct/first_name/asc

Request payload

{
    "find": {}
}

Find the distinct value of customer_id using pincode

  • It will return distinct customer_id documents/rows, where the pincode is as given in the payload.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": 382330
    }
}

$in used to get distinct

  • It will return distinct customer_id documents/rows, where the pincode is as given in the payload.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$in": [42187, 16047]
        }
    }
}

$eq used to get distinct

  • It will return distinct customer_id documents/rows where pincode equals 42187.

/api/schema/user-path/instance/database/table/distinct/customer_id
Request payload
{
    "find": {
        "pincode": {
            "$eq": 42187
        }
    }
}

$gt used to get distinct

  • It will return distinct customer_id documents/rows where the pincode is greater than 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$gt": 42187
        }
    }
}

$gte used to get distinct

  • It will return distinct customer_id documents/rows where the pincode greater than equals 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$gte": 42187
        }
    }
}

$lt used to get distinct

  • It will return distinct customer_id documents/rows where the pincode is less than 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$lt": 42187
        }
    }
}

$lte used to get distinct

  • It will return distinct customer_id documents/rows where pincode less than equals 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$lte": 42187
        }
    }
}

$ne used to get distinct

  • It will return distinct customer_id documents/rows where the pincode is not equal to 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$ne": 42187
        }
    }
}

$nin used to get distinct

  • It will return distinct customer_id documents/rows where the pincode is not in 42187.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": {
            "$nin": [42187]
        }
    }
}

$and used to get distinct

  • It will return distinct customer_id documents/rows where pincode equals 42187 and customer_id equals 4.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "$and": [
            {
                "pincode": 42187
            },
            {
                "customer_id": 4
            }
        ]
    }
}

$or used to get distinct

  • It will return distinct customer_id documents/rows where pincode equals 42187 or customer_id equals 4.
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "$or": [
            {
                "pincode": 42187
            },
            {
                "customer_id": 4
            }
        ]
    }
}

$like used to get distinct

  • It will return distinct customer_id documents/rows where first_name like "%llory".
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "first_name": {
            "$like": "%llory"
        }
    }
}

pass pincode value as string even though pincode datatype equals to number.

  • It will return distinct customer_id documents/rows where pincode equals "382350"
/api/schema/user-path/instance/database/table/distinct/customer_id

Request payload

{
    "find": {
        "pincode": "382350"
    }
}

Summary

Param Value
field /first_name,last_name
order /asc,desc

Supported headers

Header Description
x-am-response-case It will change the response keys text as requested case.
"x-am-response-case": "camelCase"
noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
x-am-response-object-type To get flat response we use this request header.
"x-am-response-object-type": "make_flat"
no_action | make_flat
x-am-meta To get the meta-data of requested API.
"x-am-meta": "true"
false | true
x-am-secret Place secret id from API Maker.
"x-am-secret": "6381b80359bdbd3a87c9abd5"
x-am-internationalization We can get backend error messages in any user language and directly show them to the user in UI, so the user can take appropriate actions.
Provide saved internationalization name in request header.
"x-am-internationalization": "HINDI"
x-am-run-in-sandbox System will try to run requests in maximum provided sandbox, so if 1 provided every request will run in one sandbox, even if we have multiple sandbox with multiple API Maker instances.
"x-am-run-in-sandbox": "0"
x-am-content-type-response We can provide response type in request header. As provided header value we can expect the response type.
"x-am-content-type-response": "application/json"
application/json | text/xml | text/yaml
x-am-cache-control To reset the cache of the requested API manually and get fresh data, we can use 'x-am-cache-control' request header.
"x-am-cache-control": "reset_cache"
no_action | reset_cache
x-am-get-encrypted-data Encrypt response data and get in to the response.
"x-am-get-encrypted-data": "get_data_and_encryption"
no_encryption | get_only_encryption | get_data_and_encryption
x-am-authorization Provide token of API user in "x-am-authorization" header which will be generated from API Users inside API Maker.
"x-am-authorization": "eyJhbGciOiJIUzI1NiIsdlRrblJlcS"
x-am-user-authorization User token should be provided in 'x-am-user-authorization' header which will be generated based on some database user if required.
"x-am-user-authorization": "eyJhbGciOiJIpc1BydlRrblJlcS"
x-aws-authorization Provide AWS Cognito token in request header 'x-aws-authorization', if required.
"x-aws-authorization": "eyJhbGciOiJIUc1BdlRrlJlcS"
x-google-authorization Provide Google user token in request header 'x-google-authorization', if required.
"x-google-authorization": "eyJhbGceyJpc1BdlRrlJlcS"
x-azure-authorization Provide Azure active directory token in request header 'x-azure-authorization', if required.
"x-azure-authorization": "eyJhbGciOiJIUzI1NiIJpc1BdlRrlJlcS"
x-no-compression If user do not send 'x-no-compression' in request header, and response characters are more than value of "maxCharsResToCache" than the response will be compressed.
"x-no-compression": "true"
x-am-sandbox-timeout If any API did not give a response within given time, the sandbox will break and give a proper error message in the response.
"x-am-sandbox-timeout": "13000"  // milliseconds
x-am-encrypted-payload When user sent encrypted payload, user must have to sent "x-am-encrypted-payload:true".
"x-am-encrypted-payload": "true"