# By Region

Suppose you want to search records within a specified region. For this, we have created the custom action with name “**Inogic.Maplytics.API.Region**” (**ikl\_InogicMaplyticsAPIRegion**). Custom action accepts the following parameters.

* **RegionType:** Provide the type of region based on which user wants to search. , i.e., City, State, County, Country, PostalCode, PostCode Sector, PostCode(Outward Code), PostalCode Areas “City/Postalcode/State”. You need to provide any of the above.
* **Region:** Provide the region where you need to search. E.g., New York.
* **Entity:** Specify the entity name. e.g., “Account".
* **ViewName**: Specify the view name. e.g., “My active accounts”.

When user passes the required parameters and executes this action then the action will return records collection.&#x20;

To execute region action using the C#, use following code.

```
string requestName = "ikl_InogicMaplyticsAPIRegion";

                    //create request object
                    OrganizationRequest orgReq = new OrganizationRequest(requestName);                   

                    //for region
                    orgReq["RegionType"] = "city";
                    orgReq["Region"] = "New york";

                    //Entity & view
                    orgReq["Entity"] = "account";
                    orgReq["ViewName"] = "My Active Accounts";

                    OrganizationResponse response = service.Execute(orgReq);

                    EntityCollection recordsCollection = (EntityCollection)response.Results["RecordsCollection"];

```

To execute the action using the javascript (web api) you can use following code.

```
var actionObj = {
             RegionType: "City",
             Region: "New York",
             Entity: "account",
             ViewName: "My Active Accounts",
         }

         // call this function to execute the action 
         execute(actionObj, "ikl_InogicMaplyticsAPIRegion()", function (data) {

              alert("Success: " + data);

         }, function (error) {
             debugger;
             alert("Error: " + error.message);
         });

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maplytics.com/maplytics/azure-map/features/maplytics-api/by-region.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
