cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAM clientAPI.read API data fetch Error

kakkem
Participant
0 Likes
547

Hi Experts,

We are trying to fetch data in SAP Asset Manager Custom Extension using clientAPI.read method. Our Request query is as below
reqQuery = "MyEntity?$filter=(FormId eq '10' and Version eq '100')"
we are requesting the query as below
this.samContext.clientAPI.read("/SAPAssetManager/Services/AssetManager.service", reqQuery, []).then((result) => {
:
:
}
We are getting below error.
mdk.trace.odata: Error: com.sap.cloud.mobile.odata.core.UndefinedException: Undefined entity set: MyEntity?$filter=. from MyEntity?$filter=(FormId eq '10' and Version eq '100') queryOptions: undefined
Please let us know if there is an issue with the above query. Can you please provide us with an example of how to fetch data with a filter?

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Likes

Please look at the syntax for the clientAPI.read function. Query options are not concatenated with the Entity set name, they are passed as a separate argument in the read function. In your example it would look like this

this.samContext.clientAPI.read("/SAPAssetManager/Services/AssetManager.service", "MyEntity", [], "$filter=(FormId eq '10' and Version eq '100')").then((result) => {

You can of course use variables to pass in the arguments instead of static strings if needed based on your use case.