How to access a two levels deep nested association of an OData V2 service? - odata

I have exposed an OData V2 Service via the ABAP Service Gateway (SEGW) based on a CDS View. The view contains indirect associations to two other views (entity_1 > entity_2 > entity_3 - no direct connection between entity_1 and entity_3). My problem is that I can't access entity_3 from entity_1 via entity_2. Accessing entity_2 works just fine by using /service_name/entity_1?$expand=to_entity_2 but after that I can't dive any deeper. I tried using /service_name/entity_1?expand=to_entity_2($expand=to_entity_3) but as soon as I put a second query in parenthesis after the first one I receive an error message.
Do I use a wrong syntax or are these nested calls not supported by OData V2? And if it's not supported how do I solve my problem? The service is used in a SAPUI5 application where it should be bound against a tree table so I need (three) different levels in my service.

Apparently the syntax was wrong. It works if you use /service_name/entity_1?$expand=to_entity_2,to_entity_2/to_entity_3.

Related

OData in Datafactory

I have a task toget some data from an external supplier.
They have a Rest OData API. I have to connect using a subscription-key(APIKey).
When creating the OData LService, I add an Auth Header: "subscription-key" and in the Value field, I enter my key. After saving, I create a new dataset, and the OData LinkedService, provides me with the remote tables. I can choose the table I want and after that I create a pipeline to copy data from that table to my Azure SQL server.
This works fantastic :-)
However, after closing my browser and re-open it, the subscription key that I have entered earlier on the linked service, is now replaced with stars as it is a securestring. When I now run my pipeline, it will think that my key is the ten stars that have replaced my real key.
What am I doing wrong here ?
Also I would prefer to get my value from the KeyVault, but it seems that this is not possible on ODat connections....
Hope someone is able to provide some insight here :-)
BR Tom
From my testing I did not get any error on re-running. However coming to dynamic keys - I was not able to achieve it using the ODATA linked service.
Alternatively, if you can hit the ODATA endpoint with REST / HTTP Connector
You could - have a Web Activity to get the keys from the Key Vault and Set in the Variable.
WEB Activity URL : https://<your-keyvalut-name>.vault.azure.net/secrets/<your-secret-name>;
You could access the output of the web Activity using : #activity('Web1').output.value & Store in a variable.
You can reference this variable as the SUBSCRIPTION KEY for the subsequent steps in the REST/HTTP dataset.
You could pass it along the additional headers

Is there any way to send a filter/parameter in Client OperationMode?

Hello Stackoverflow Community,
i developed an abap program that displays roles in a tree output and now want to create a ui5 application with the same functionality. For this, i created an OData Service where the GET-Method simulates my abap program via a SUBMIT-Call and returns the output tree after then displays it using a TreeTable.
Now the problem: I am using OperationMode "Client" for my OData Service so filtering is done on the client side. My backend program needs parameters to function though. Is there a way to pass any arguments to my GET-Method while using OperationMode "Client"?
I have tried the bindRows() approach where u pass filters but this only works in "Server" OperationMode. Sadly i cant use "Server" OperationMode because it would result in having to simulate my abap program everytime the user expands a TreeTable-Node, rendering my program unuseable because of performance issues.
Hoping someone can help me on this issue and looking forward to your answers!
Solved this issue by sending a request in "Server"-Mode, saving the odata response to a json model and then binding said model to my treetable with "Client" operationmode.

GraphQL Resolvers on client side for Apollo-iOS

How do I write a resolver for making multiple API calls to fulfil a GraphQL query using Apollo-iOS on the client side (in my swift project)?
For Example: If, to construct a Person object from a query having name and age parameters - I have to fetch name from a service call and age from another service call and stitch them to form the Person object, then how would the resolver look like and where should I write it?
Any help is appreciated.
I believe GraphQL resolvers are only a concept server-side. The client simply asks for the data. The server is supposed to resolve the query sent by the client so your resolvers should make the necessary calls to different services to be able to resolve the query completely by accessing the single endpoint.
A more in-depth explanation of resolvers in GraphQL: https://medium.com/paypal-engineering/graphql-resolvers-best-practices-cd36fdbcef55
You could write your own swift code to grab data from two separate GraphQL endpoints/services if needed.

Office 365 Sharepoint API $skip/$skiptoken functionality

Going through the documentation for the Sharepoint API (located here: http://msdn.microsoft.com/en-us/library/office/dn605900(v=office.15).aspx) I am trying to figure out how to select chunks of documents. I was expecting $skip to work, as it is implied that most OData functionality should be present, but this doesn't work. I also can't figure out whether or not $skiptoken is a valid query param. It's listed in the documentation near the bottom (without further explanation), but I can't coax the proper result out of it so far.
If somebody knows about $skip or $skiptoken or another method available for getting chunked responses back, help with this problem would be great!
EDIT: to clarify, things like API_URL/files?$orderby=url&$top=5 work, but things like API_URL/files?$orderby=url&$skip=50 do not. However, I have just found a 'next' URL in the response which appears to provide server-side paging support. I'll try to figure out the use of $skiptoken from here.
The OData V4 protocol has specified (referencing 11.2.5.7 Server-Driven Paging) that:
OData services may use the reserved system query option $skiptoken when building next links. Its content is opaque, service-specific, and must only follow the rules for URL query parts.
OData clients MUST NOT use the system query option $skiptoken when constructing requests.
Thus, the implementation of the O365 SharePoint API that it publishes $skiptoken as a query option that the client should use for excluding first few items in the queried collection is a violation of the protocol. The client should use $skip for such scenario. But it seems from the O365 spec you attached that $skip is not implemented.
If you query a entity set of the O365 service and the response payload contains a next link (a #odata.nextLink annotation in the response JSON object), then it indicates that the service has server-side paging for the entity set. Typically the next link would be a URL containing the $skiptoken query option such as http://host/service/entityset?$skiptoken=n that the client can use for getting the next page.

How to escape a period (.) in WCF Data Services QueryString

I have a WCF Data Services service that exposes a set of ICD codes. The primary key for the underlying table and the data set that WCF provides access to is a varchar or string in C#.
The service works properly if I have a query like this:
http://somehost/someService.svc/IcdSet('001')
If, however, the ICD code happens to have a . in the identifier as many do, the service fails. Here's an example of one that won't work (IIS gives a 404 - Not Found response):
http://somehost/someService.svc/IcdSet('001.1')
So the question is how can I escape the period or properly pass it to WCF Data Services? It must be interpreting it as a different type of filter condition.
Note: The code for the underlying class seems irrelevant to the question but I can provide it if needed.
Edit: My guess at the moment is that IIS is trying to find a file that ends with .1') which is then producing the 404 error. But how can I tell IIS that it shouldn't be looking for files as these are all data queries?
check this out http://blogs.msdn.com/b/peter_qian/archive/2010/05/25/using-wcf-data-service-with-restricted-characrters-as-keys.aspx
Also might be of interest if you're using .Net 3.5 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5121

Resources