Does Acumatica's OData layer support $count or $inlinecount - acumatica

When paginating data from an OData service in Acumatica, it would be preferable to have access to the total row count retrievable
These are OData services exposed via Generic Inquiries in Acumatica
The OData "Standard" suggests alternative ways to do this, e.g. via the $count directive, or via the $inlinecount parameter - both of which give errors via Acumatica
Examples:
http://localhost/acumatica2018r2/OData/$count/SomeGI
http://localhost/acumatica2018r2/OData/SomeGI?$inlinecount=allpages
Both of which give errors
$count:
"Message": "The OData path is invalid.",
"ExceptionMessage": "Invalid action detected. '$count' is not an action that can bind to 'Collection([PX.Data.CEN-Centara Stores Nullable=False])'.",
$inlinecount:
"message": "Query option 'InlineCount' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",

Acumatica's REST API supports only the following parameters:
$filter $top $skip $expand $select $custom
You can find more details about Acumatica's REST API by this link

Related

How to use filter in Azure API Management Python SDK

Based on the documentation contained in the original code I try to access API Management and filter for a certain product:
credentials = ServicePrincipalCredentials(
client_id=clientId,
secret=secret,
tenant=tenantId)
client = ApiManagementClient(credentials, subscription_id)
products = client.product.list_by_service(resource_group_name,service_name,filter="displayName eq 'INTERNAL'")
which seems valid and according to documentation to me.
However I get this error:
azure.mgmt.apimanagement.models.error_response_py3.ErrorResponseException: Invalid filter clause specified: 'DisplayName eq 'INTERNAL''.
I tried to inspect the source codes of Azure API Management Python SDK which include product_operations.py, [error_response_py3.py][1], msrest-for-python/msrest/serialization.py, there is not any obvious issue.
Then, after I tried to test the relative REST API Product - List By Service of ApiManagement.product.list_by_service function, I discovered the issue may be a bug.
There are six fields can be used in the $filter URI parameter: name, displayName, description, terms, state and groups. Except groups which I don't know how to feed the corrent expression for $filter, I test the rest five fields and only displayName does not work.
The api-version value is 2019-01-01, the json response for %24filter=displayName%20eq%20%27Starter%27 in my uri parameter is as below.
{
"error": {
"code": "ValidationError",
"message": "Invalid filter clause specified: 'displayName eq 'Starter''.",
"details": null
}
}
So I think it's not your mistake while using Azure API Management Python SDK, it's a bug which seems to be not implemented or other reason.

Can't get metrics from Azure REST API

I'm sending a Postman request to get the metrics from an event grid like this:
https://management.azure.com/subscriptions/{suscription id}/resourceGroups/{name of resource group}/providers/microsoft.insights/metricDefinitions/?api-version=2018-01-01
I'm also attaching the Bearer token.
However, I keep getting the following response:
{
"message": "An error has occurred.",
"exceptionMessage": "ApiVersion: 2018-01-01 does not support query at non Arm resource Id level",
"exceptionType": "Microsoft.Online.Metrics.MetricsMP.Utilities.RPRequestFormatException",
"stackTrace": " at Microsoft.Online.Metrics.MetricsMP.Controllers.MPController_MetricDefinitions_Base.<MetricDefinitionAtResourceGroup>d__4.MoveNext() in ...
....
}
What does that mean and how can I fix it? I've been looking on the Internet and there's not much information.
Your URL is wrong.As far as I know,if you want to retrieve metric definitions, the rest api is that
Method: GET
Request URI:
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/microsoft.insights/metricDefinitions?api-version={apiVersion}
For more details, please refer to
https://learn.microsoft.com/en-us/rest/api/monitor/metricdefinitions/metricdefinitions_list
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-rest-api-walkthrough.
To get the metric definitions use this rest API
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource
ProviderNamespace}/{resource
Type}/{resourceName}/providers/microsoft.insights/metricdefinitions?api-version=2018-01-01
To get the metrics with optional parameters use this rest API
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/metrics?timespan={timeSpan}&interval={timeGranularity}&aggregation={AggregationType}&metricnames={metricName}&api-version=2018-01-01
You missed the resource type and name in the request url, the url should be like below:
https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricDefinitions
Reference: https://learn.microsoft.com/en-us/rest/api/monitor/metricdefinitions/list
If you want to list metric definitions of an event grid, your url should be:
GET https://management.azure.com/subscriptions/{subscription id}/resourceGroups/{resource group name}/providers/Microsoft.EventGrid/topics/{event grid topic name}/providers/microsoft.insights/metricDefinitions?api-version=2018-01-01
Test result:

Filter Query failing for Microsoft Graph

I am trying to perform a filter query against Microsoft Graph (eg):
https://graph.microsoft.com/beta/me?$filter=extension_d8dde29f1095422e91537a6cb22a2f74_skypeId+eq+'joe.smith'
But I always receive a similar response:
{
"error": {
"code": "BadRequest",
"message": "Filter not supported.",
"innerError": {
"request-id": "d1b45316-80c9-4ce1-bfe3-3c07a4af42a9",
"date": "2016-08-25T18:53:45"
}
}
}
I am able to this with Azure AD Graph, but I want to achieve a similar result with MS Graph:
https://graph.windows.net/contoso.com/users/joe#contoso.com?api-version=1.21-preview&$filter=extension_d8dde29f1095422e91537a6cb22a2f74_skypeId+eq+'joe.smith'
Is filtering with extension properties not possible with MS Graph? Is there a correct way of doing this or some other substitute query that could help me query for extension properties?
Thanks
This issue has now been fixed and deployed.
Vishrut - please try your query again and confirm that this is now working for you.
I could reproduce this issue too. But filter the users collection using the build-in property works well for me. It seems that the Microsoft Graph doesn't support to filter the custom property for the users rest API.
You can submit the feedback from here if you require this feature.

Filter (searching) on Microsoft Azure (graph) API

I would like to query the Microsoft Azure AD by passing either a mobile number or a postal code. I am able to filter using the givenName using the startsWith() function but not able to search with mobile/postal code.
My request is users?$filter=postalCode%20eq%20'560036'&api-version=1.6
and getting the response:
{
"odata.error": {
"code": "Request_UnsupportedQuery",
"message": {
"lang": "en",
"value": "Unsupported or invalid query filter clause specified for property 'postalCode' of resource 'User'."
}
}
}
According to this old post in Microsoft Developer you can add OR clause to filter more than one field if you use startsWith() function.
users?$filter=startswith(postalCode, '560036') OR startswith(mobileNumber, '123456')
Of course, you still have to encode equal sign, parenthesis and spaces
My issue was that I was trying this on an Azure AD B2C tenant. This is not supported on this type of tenant.
I've missed the note in the docs about this:
https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http
The note's text is below:

InvalidFilter with Azure Resource Manager resources API

Trying to use the Azure Resource Manager API to search for resources. First I tried this:
GET /subscriptions/xxx/resources?$filter=startswith(name,%20'web')&api-version=2015-01-01
Invalid $filter 'startswith(name, 'web')' specified in the query string. Details: 'Unsupported filter function found:'startswith'. Property name:'name'. Supported functions: 'substringof''
Then I tried this:
GET /subscriptions/xxx/resources?$filter=substringof('web',%20name)%20eq%20true&api-version=2015-01-01
Invalid $filter 'substringof('web', name) eq true' specified in the query string. Details: 'Unsupported token found in $filter string.'
I'm not an OData expert, so I'm not sure if my syntax is wrong, or if I'm trying to do something that's not really supported in this API.
The query must be:
GET /subscriptions/xxx/resources?$filter=substringof('web',%20name)&api-version=2015-01-01
Leave out eq true. Even though it can be seen as part of official examples of v2 and v3 odata protocol, it seems the Azure API doesn't support this.

Resources