Generally I want some equivalent of:
select * from my_entity where id IN (1,2,3)
In odata it should be like that:
GET http://my-host.com/Api/V4/MyEntity(1,2)
But for API which I try to use the upper url does not work :( So does odata API supports get entities by multiple ids? If yes - what url pattern to use?
Related
I've created an ADF flow that loops over URL's to fetch OData using the OData connection.
However, not all fields are available in all URL's, there are certain ones that are available in one URL, but not in the other. A $Select is used to select the fields that we need.
Is it possible to have an optional selection (as in, if the path is not available, do not fetch this field and return null instead for instance)? Would help us a great deal.
I've tried adding ? after the field, but that does not work. $select=Field1,Field2,FieldOptional?
Thanks
As I understand you are trying to loop through a bunch of a URL and the query on the ODATA URL will change and so will be the fields . I think you can use a lookup where you pass the unique url and its gives the fields and then concatenate the url with the fields and make a odata call .
I'm using getRecentFiles MS Graph API and I'd like to filter out only certain file types (by file extension). However, when I try $filter query parameter it is ignored. Documentation on the method doesn't mention anything like this.
Is this behavior expected or is it a bug?
I believe that is expected as no OData query parameters link is not present on the page (when OData query parameters are supported, then its listed in a paragraph).
I have not managed to make it work, neither for drive item properties (eg. id, creation date) nor for nested properties (remoteItem/name or remoteItem/createdBy/user).
I'm new in SAP HANA and I'm trying to sort a table in .xsodata file. Is that possible?
Best regards.
There's no option to specify the sorting order in the odata service definition.
Usually, the ODATA client specifies the expected order via the $orderby URL parameter.
I have the problem that our backend uses an OData-"like"-Processor which has some special functions. It is oriented at OData_2.0
So the question will be:
What is the most OData like approach for this kind of the following requests
Our backend Data-Model has no single-attribute-keys. But it's recommended to be OData-Like if possible.
First: I need to delete several objects via one OData Request. My first idea is to use filters to define which objects should be deleted. But I', not sure if this is the right approach.
For Example: I want to delete all Items which have a price greater than 10.00
http://.../<oDataServiceX>/Item?$filter=ItemPrice gt 10.00
Second: When I want to delete an object which is not identifiable by one single key-attribute. How can I define that in the classical OData-Delete-Request-Syntax.
Is the following OData-like?
http://.../<oDataServiceX>/Item(1,54,2) //3 Attributes which define the key for the Item
Or should I do a filter again? (If filter is a proper way of doing this).
http://.../<oDataServiceX>/Item?$filter=keyAttr1 eq 1 and keyAttr2 eq 54 and keyAttr 3 eq 2
You can't delete multiple entries in a single OData query, you need first to retrieve their keys and then send multiple delete requests. There are two ways to improve this process:
Use OData batch to send all delete request in a single HTTP call.
Use some of libraries that can simulate deletion using filter (internally they will issue multiple requests but for the application it will look like a single call). One of such libraries is Simple.OData.Client.
Hope this helps.
Odata v4 supports the format DELETE /entity(key1='', key2='') and so on.
However, for oData v2, one option could be to use the request body to pass some data over. DELETE /entity, with data in the body.
The documentation states that the convention is to delete an entity by key. However, this was the approach followed when we had to delete by multiple keys for an odata v2 service. Also while implementing this using oData v2 libraries, we had to add a routing convention to support Delete without a key.
in OData V4 inside an $expand query you can nest as an option:
1)$expand
http://services.odata.org/V4/OData/OData.svc/Categories?$expand=Products($expand=ProductDetail)
2)$levels
Entities($expand=ChildItems($level=x)) where ChildItem is the same type of Entity
3)$select
http://services.odata.org/V4/OData/OData.svc/Categories?$expand=Products($select=Price)&$select=Name,Products
I would like to expand ProductDetail like this but of course it does not work
http://services.odata.org/V4/OData/OData.svc/Categories?$expand=Products($expand=ProductDetail&$select=Price,ProductDetail)&$select=Name,Products
This call gets
Query parameter '$select' is specified, but it should be specified exactly once
so you would think that you can $select only on the main entity but case #3 works perfectly.
I know that I could rewrite my query to achieve my objectives but I would like to know if this is possible.
Thanks,
Alessandro
The key is the separator. You have to separate each option with ";".
I found the answer here
Case 3 becomes
http://services.odata.org/V4/OData/OData.svc/Categories?$expand=Products($select=Price,ProductDetail;$expand=ProductDetail)&$select=Name,Products