Easy-Acumatica Docs

Inquiries Service

The `InquiriesService` provides two distinct methods for running Acumatica Generic Inquiries (GIs), each corresponding to a different API endpoint type. Understanding the difference is key to fetching the data you need effectively.

Importing Helpers

Depending on which method you use, you will need to import the appropriate builder from `easy_acumatica.models`.

python

from easy_acumatica.models.inquiry_builder import InquiryOptions
from easy_acumatica.models.filter_builder import F
from easy_acumatica.models.query_builder import QueryOptions

Service Methods

get_data_from_inquiry_form(...)

This method executes a contract-based inquiry by sending a `PUT` request to an endpoint like `/entity/Default/{version}/{inquiryName}`. It is used for inquiries that are exposed as "forms" and require parameters to be sent in the request body. You must use the `InquiryBuilder` to construct the payload for this method.

python

# Use InquiryBuilder to set parameters in the request body
opts = (
    InquiryBuilder()
    .param("InventoryID", "SIMCARD")
    .expand("Results")
)

# Execute the inquiry form via a PUT request
inventory_summary = client.inquiries.get_data_from_inquiry_form(
    "24.200.001",
    "InventorySummaryInquiry",
    opts
)
execute_generic_inquiry(...)

This method executes a standard OData Generic Inquiry by sending a `GET` request to an endpoint like `/odata/{inquiryName}`. This is the more common way to query GIs. It uses the familiar `QueryOptions` and `F` factory for filtering, selecting, and ordering data via URL parameters.

python

# Use QueryOptions to filter results via URL parameters
opts = QueryOptions(
    filter=F.Status == 'Active',
    select=['CustomerID', 'CustomerName'],
    top=10
)

# Execute the generic inquiry via a GET request
active_customers = client.inquiries.execute_generic_inquiry(
    "CustomerListInquiry", 
    opts
)

# The result is often in a 'value' key for OData inquiries
for customer in active_customers.get("value", []):
    print(customer["CustomerName"])
Easy-Acumatica v0.3.9 — Created and Developed by Matthew Hirstius (Nioron07).
Significant Contributions made by Chris Xu
Want to see the NPM version? See it here