Question

REST API Generic Inquiry Filter. "Input string was not in a correct format

  • 15 December 2023
  • 18 replies
  • 229 views

Userlevel 2
Badge

Hi Everyone,

Have an issue with filtering a GI through the REST API.

Below is the setup for my endpoint filter.

And this is my request body

I’m getting the below error 

If I send a word like “test” instead of the actual ID then there is no error however if I send a number formatted as a string then it isn’t happy.

Has anyone seen this before / know a fix?


18 replies

Userlevel 7
Badge +17

@matthewgerdan I understand that you provided the StringValue in the endpoint but can you please also let us know what is the datatye that you mentioned in the code level?

I’m assuming that the code level and data type were different, hence you are getting this issue.

Userlevel 2
Badge

@matthewgerdan I understand that you provided the StringValue in the endpoint but can you please also let us know what is the datatye that you mentioned in the code level?

I’m assuming that the code level and data type were different, hence you are getting this issue.

Hi @Naveen Boga I've included screenshots of the DAC, GI Parameter and table schema, they are all set up as strings, this field is a key field so I’m not sure if that might be causing an issue.

 

Userlevel 7
Badge +17

@matthewgerdan  This is wired !!

All looks good to me except that field INPUT MASK, you provided 99999…., which can allow only digits. Can you please change this input mask and verify?

 

Userlevel 2
Badge

@Naveen Boga No Luck ☹️

 

Userlevel 7
Badge +17

@matthewgerdan Okay!!

Can you please share the GI?

Userlevel 2
Badge

@Naveen Boga I’ve attached the RPX as XML is this what you needed?

Userlevel 7
Badge +17

@matthewgerdan I was not able to import this GI for some reason and getting below error.

 

Userlevel 2
Badge

@Naveen Boga It won’t let me upload it in RPX however the GI is using a customer table 

 

Userlevel 7
Badge +17

@matthewgerdan Thanks for sharing the screenshots here and all looks good.

Do you have any logic implemented in the graph and assigning values?

Userlevel 2
Badge

@Naveen Boga Nah the graph only contains a couple views 

 

Userlevel 7
Badge

Hi @matthewgerdan were you able to find a solution? Thank you!

Userlevel 2
Badge

@Chris Hackett Unfortunately, no.

I’m pretty sure that it has something to do with the field being filtered being a key field, I have another request that also passes a number as a string and has no issue however in that case the field is not a key.

Userlevel 6
Badge +5

Are there more than one result using that ID?  If it's a key field it is expecting a single response.  If you send "123" does it give the same error? 

Userlevel 2
Badge

Hi @bryanb39, using 123 instead of an actual number worked however all the keys in the DB are unique.

 

Userlevel 4
Badge +2

A couple of ideas

Could this be a naming convention issue I notice your Field Name for the table is ShopifyLocationID and the name of the Parameter for your GI that is used in the condition is also ShopifyLocationID… could it be getting confused?

By that I mean how is the Parameter vs the Field Identified in your Endpoint Mapping (I see in the first screen shot the parameter declared as the Filter but can’t see any more than the “Shopify Location ID” in the Mapped Field)…

I would try renaming this filter/remapping endpoint and see if you have the same issues…

The other option is I noticed you have this exposed via oData you could try filtering it in the URL parameter call and see if you get a similar error there, might give us a different error message to try to help find the issue...

Userlevel 1

Hi there,

I am working with the Rest API and ODATA4. to pull data from Acumatica.

The query syntax allows for the inclusion of a $filter parameter in the REST query to limit the data returned.

In the video presentations I can see a few of the comparisons supported: eq for equal, and I think that it does gt and lt for greater than less than etc - but I’m wondering if there’s some comprehensive documentation anywhere that would describe all the different types of filtering you could do for example “in” (as like a sql “in” statement) would be very useful. A search on the website didn’t reveal anything.

Many thanks in advance,

Daniel Graham

Userlevel 4
Badge +2

https://www.odata.org/documentation/odata-version-3-0/url-conventions/

Userlevel 1

Thanks very much for this - that’s hugely helpful.

Daniel Graham

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved