cancel
Showing results for 
Search instead for 
Did you mean: 

oDATA invalid key predicate

Former Member
0 Kudos

Hi,

I am trying to perform a get_entity_set read with a key passed

in order to extract all data in the collection with a specific key in the model [fileid in my case].

The url I pass to perform the read is

/sap/opu/odata/sap/Z_COLL_PORTAL_SRV/fileRepositorySet('fileid20150915')

and when I execute I get the message

'Invalid key predicate'

Can anyone help me to find how to fix ?

Accepted Solutions (0)

Answers (3)

Answers (3)

GowthamRaja
Participant
0 Kudos

Hi Claudia,

As Ashwin said, you should filter as mentioned in the URL syntax for getting the collection list. If you want to get a single record you should send the field with in the phraces as u have mentioned.

Former Member
0 Kudos

Try the URL as below:

/sap/opu/odata/sap/Z_COLL_PORTAL_SRV/fileRepositorySet('20150915')


Only when there are multiple key fields, you need to mention field name for filter


Charles

AshwinDutt
Active Contributor
0 Kudos

Hello Bressi,

Is it a Date which you are sending as input as Key ?

The URL you are using is to Read the data based on a Key value and for READ GW response will always have a single entry as output and can be null if no matching found.

For your scenario you need to send inputs as part of filters to get all the data matching to the input you are sending.

Please check the below for details ->

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

No it is not a date the key I am passing in the URL.

Do you then mean I should use a $filter parameter ?


Regards,

Claudia

AshwinDutt
Active Contributor
0 Kudos

Yes since you want to get collection of data matching to the input you are sending then you need to implement QUERY/Get_Entity_Set method. So that you get the collection of data as you are expecting.

Your URL will look something like this ->

/sap/opu/odata/sap/Z_COLL_PORTAL_SRV/fileRepositorySet?$filter=<Property_Name> eq 'XXXXXXX'

Former Member
0 Kudos

Also you must read the filters in your get entity set method.