Skip to main content
Solved

API calls and OData alias

  • March 25, 2025
  • 5 replies
  • 79 views

Forum|alt.badge.img+1

Hi, 

I’m trying to call this API to get data for multiple countries and attributes in one call:

/AttributeValueHandling.svc/AccountingAttributeSet(Company='{Company}',Attribute='{Attribute}')/AccountingAttributeValueArray

 

I’ve tried to use OData alias without succes:

/AttributeValueHandling.svc/AccountingAttributeSet(Company=@comp,Attribute=@attr)/AccountingAttributeValueArray?@comp=["1","2","3","4"]&@attr=["A","B","C"]

 

Is there some way to get this to work in one call? Using alias or some other way?

 

Best regards

Best answer by dsj

Hi ​@AndersHallberg 

I don’t think it’s allowed to have multiple values in the path parameters.

May be the reference for AccountingAttributeValue could give you the same results you wanted?

Eg:

AttributeValueHandling.svc/Reference_AccountingAttributeValue?$filter=((Company eq '1' or Company eq '2') and (Attribute eq 'A' or Attribute eq 'B'))

5 replies

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • March 25, 2025

I have never heard about that being possible, so you have to do one call per company and attribute, in this case. It's because of the nature of this page being a master/detail page. If there had been a list page will all attributes, that could have been used.

 


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • March 25, 2025

PS. Perhaps you can create a simple query in Query Designed to get the data you want, and then use the resulting projection that should be created to support it?


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • March 25, 2025

Thanks! We’ll give the Query Designer option a shot.

 

Best regards


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • Answer
  • March 25, 2025

Hi ​@AndersHallberg 

I don’t think it’s allowed to have multiple values in the path parameters.

May be the reference for AccountingAttributeValue could give you the same results you wanted?

Eg:

AttributeValueHandling.svc/Reference_AccountingAttributeValue?$filter=((Company eq '1' or Company eq '2') and (Attribute eq 'A' or Attribute eq 'B'))


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • March 25, 2025

Thanks ​@dsj ,

 

That’s what I was looking for.

 

Best regards