By using this website, you agree to our Terms of Use (click here)
For REST API, does DAC need a single key field?
I have performed these steps:
1. Created an adhoc SQL query and published it to the Acumatica server.
2. Created a DAC and Generic Inquiry from that published view. It returns data.
3. Created a Web Service Endpoint.
4. Tested the endpoint from Postman. I can get a response for the $adHocSchema GET request.
When I perform a getList request, I get the "PX.Api.ContractBased.OptimizedExport.CannotOptimizeException" message. I have not applied the 'isKey' attribute to any of the DAC fields because the view really has a multi-field key result. e.g. CompanyID/InvoiceRuleID/BillingRuleID is the key. These are returned in the result.
Should I create a virtual field of the fields and make that the key?
Thanks,
Tim
I have applied the "isKey" attribute to all of the key fields in the DAC. Using Postman, I have successfully retrieved data using a PUT verb and entering a filter parameter value in the body.
{
"CompanyCD" : {"value": "<some value>"}
}
If your API is readonly, you can use ODATA call to return REST response. It returns a nice flat array structure that works nicely in JavaScript.
GET /OData/<CompanyCd>/<Your GI> HTTP/1.1
Header: Accept: application/json
Tim
Wow, very interesting. Thanks for sharing this Tim. Just curious, do you see an advantage to using the web service endpoint to get the JSON over using the OData path to return JSON like in this post?
