SAP CDS Odata URL in ADF - azure-data-factory

I am new to azure data factory (ADF) and trying to create a dataset from an Odata source. The only problem here is that the Odata URL was developed in SAP CDS and so has custom query options as shown below:
"http://XXXXXXX/ZC_XXX_TU_SR_ACTIVITY_CDS/ZC_XXX_TU_SR_Activity(p_warehouse='E065',p_from=datetimeoffset'2021-06-01T00:01:01',p_to=datetimeoffset'2021-08-11T23:01:01')/Set"
When choosing the path I expect only one path in the options but I get 2 - ZC_XXX_TU_SR_Activity and ZC_XXX_TU_SR_ActivitySet so I am unsure of which one to use even though I have tried both
When writing the query, I have tried:
?(p_warehouse='E065',p_from=datetimeoffset'2021-06-01T00:01:01',p_to=datetimeoffset'2021-08-11T23:01:01')/Set
?(p_warehouse='E065'&p_from=datetimeoffset'2021-06-01T00:01:01'&p_to=datetimeoffset'2021-08-11T23:01:01')/Set
?(p_warehouse=%27E065%27&p_from=datetimeoffset%272021-06-01T00:01:01%27&p_to=datetimeoffset%272021-08-11T23:01:01%27)/Set
I have also tried to use all 3 options without the '?', "()" and the '/Set' but I am still getting errors.
I get this error:
"query (p_warehouse='E065',p_from=datetimeoffset'2021-06-01T00:01:01',p_to=datetimeoffset'2021-08-11T23:01:01')/Set failed with status code InternalServerError and message SY/530An exception was raised."
I have run out of ideas now and don't know what else to do. Please help. Thanks!

Note: The OData connector copies data from the combined URL: [URL specified in linked service]/[path specified in dataset]?[query specified in copy activity source].
Here, I could see that you have the root path as http://XXXXXXX/ZC_XXX_TU_SR_ACTIVITY_CDS and the resource path as ZC_XXX_TU_SR_Activity or ZC_XXX_TU_SR_ActivitySet.
So, there is an issue passing the query in :
System Query Option :
System Query Options are query string options that a client may use to
alter the amount and order of data returned by an OData service for
the URL-identified resource. All System Query Options have a “$”
character before their names.
Custom Query Option:
Because the character "$" is reserved for system query options, custom
query options MUST NOT begin with it. A custom query option can start
with the “#” character, however this can cause custom query options to
clash with function parameter values supplied via Parameter Aliases.
This URL addresses, for example, give a ‘secURLtytoken' through a
custom query option.
This is for more information: URL Conventions (OData Version 3.0)

Related

Is there any way to get table metadata using postgREST

I need to get table metadata like primary key, column type etc. using PostgRest. By executing the root path / of my PostgRest app I am getting JSON that contains all needed data in definitions object.
Unfortunately there is no endpoint to get it and there is no information about that in documentation.
I have tried to execute the following endpoints:
/table/parameters
/table/definitions
/table/schema
All returns 404 error code.
Is there any way to get metadata?
You'd have to write a view or function and call it. In that SQL return the metadata from anything in your db.

Proper multi-id syntax when using the custom_file_ids[] query parameter for the CLIO API "contacts" endpoint

What is the correct API syntax for using the custom_file_ids[] query parameter to specify multiple fields (but not all) in the CLIO API contacts result set? I need to specify multiple custom fields. I can get it to work for a single field, but not multiple fields at the same time.
Specifically, how do I specify and delimit the multiple fields? I have tried the following:
custom_file_ids[]=1234567,2345678
custom_file_ids[]=[1234567,2345678]
custom_file_ids[]=(1234567,2345678)
custom_file_ids[]={1234567,2345678}
custom_file_ids[]=1234567:2345678
The API documentation at https://app.clio.com/api/v4/documentation is silent on the list syntax that it expects.
Below is one specific API call I tried (both the actual URL-encoded call, and a decoded one for clarity) using a simple comma-delimited list, but which only returns custom field data for the first ID in the list--not the second. If I enclose the ID list in any kind of brackets (per above), the endpoint returns a 404 error.
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567%2C2345678&custom_field_values[4529224]=true&fields=id%2Cname%2Cprimary_address%2Cprimary_work_address%2Cis_client%2Ctype%2C%20primary_email_address%2Cprimary_phone_number%2Ccustom_field_values%7Bid%2Cfield_type%2Cfield_name%2Cvalue%2Ccustom_field%7D
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567,2345678&custom_field_values[4529224]=true&fields=id,name,primary_address,primary_work_address,is_client,type,primary_email_address,primary_phone_number,custom_field_values{id,field_type,field_name,value,custom_field}
Try:
custom_file_ids[]=1234567&custom_file_ids[]=2345678
I was able to do this with Contacts Custom Fields by putting custom_field_id[] on the URL as many times as you have IDs.
I hope this helps.

How to use scopeDescriptor and subjectTypes in VSTS Graph api groups list query?

I am trying to resolve a particular VSTS group by name to retrieve the identityDescriptor property. Rather than query all groups and filter, I want to leverage the query parameters supported. Looking at VSTS Groups - List API, it supports the additional query parameters scopeDescriptor, and subjectType. However, I keep providing bad values for these parameters.
However, when I specify any combination of these I get 0 results. In addition, as soon as I add a scopeDescriptor, I hit an Microsoft.VisualStudio.Services.Graph.InvalidSubjectTypeException -> HTTP 400 Bad Request.
Questions:
What are examples of expected values for subjectTypes?
Edit 1
subjectTypes are not the actual type, but the subtype that prefixes the subject descriptor. For example -> vssgp,aadgp:
"subjectDescriptor": "vssgp.Dc0NDgzLTzQ1NwOTI5LTI0NTcwNDLTAtMwUy0xLTktMTAtMC0wMjgxNjcxNDU0OS0zMU1MTM3NDI0NS0yMjUzNzA0ODMtE"
What are examples of expected values for scopeDescriptor?
Example query urls:
- Working:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?api-version=4.1-preview.1
- Working subjectTypes:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?subjectTypes=vssgp&api-version=4.1-preview.1
- scopeDescriptor throws:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&api-version=4.1-preview.1
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&subjectTypes=Microsoft.TeamFoundation.Identity&api-version=4.1-preview.1
You can get the scope descriptors for a project or a collection by making an api request to https://vssps.dev.azure.com/{organization}/_apis/graph/descriptors/{Id}(replace id with projectId if you want to get the scope descriptor for a project and so on).
For example if you want to get the scope descriptor for a project then simply replace the storage key in the request URL with the project Id and in response you get the scope descriptor. The scope descriptor has the following format scp.(long unique identifier).
P.S: More on how to get descriptors can be found here https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/descriptors/get?view=azure-devops-rest-5.0. Remember storagekey can be substituted with projectid or collectionid to get specific descriptors.
Regarding subjectTypes, it is the group type, such as vssgp, aadgp, you can get it from descriptor value of each group.

Using RESTFul Oracle APEX

I am building a mobile App using Appery.io platform which uses MongoDB -based database. I need to link this DB to Oracle database and use APEX to design an interface such that users can query, update the mobile App DB from Oracle as well as Oracle DB can be updated from the mobile App.
In APEX, I use the URI with GET method:
https://api.appery.io/rest/1/db/collections/Outlet_Details/
And I add the header:
X-Appery-Database-Id
When I run the query in the APEX where I insert the Database-Id, APEX shows the table/collection Outlet_Details in JSON format. However, not the entire table is shown due to, I think, the length of CLOB type.
Now my main problem is I need to query this table/collection called Outlet_Details by a column named: _id. So when I use the following URI:
https://api.appery.io/rest/1/db/collections/Outlet_Details/1234
It returns the specific record that ha _id = 1234. However, I do not want to hardcode it. Instead, I need to have more like where condition such that I can query based on any column value (e.g. userId instead _id). The CURL command is as follows:
curl -X GET
-H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9"
-G --data-urlencode 'where={"userId ": "1234"}'
https://api.appery.io/rest/1/db/collections/outlet_details/
My problem is how to insert such a command into APEX, specailly (where) part.
In this tutorial, oracle database is used. Hence using where condition with =:DEP condition, and then bind it to a variable is pretty straightforward. However, I need to replicate this tutorial with my MongoDB.
The other question, which I guess would clarify a lot to me, in the aforementioned tutorial, there is a prefix URI that is by default APEX shema URI. Even when I insert different URI template, the resultant URI will append APEX to the one I inserted. How to build a service there using different URI?
I found that APEX takes where condition as encoded parameter in the URL. Something like:
https://api.appery.io/rest/1/db/collections/Outlet_Details?where=%7B%22Oracle_Flag%22%3A%22Y%22%7D
The header is same and no input parameters.
This can be done from Application builder > New Application > Database > Create Application > Shared Componenets > Create > REST and then start inserting the header, utl .. etc.
You can refer to this link as a reference encoded URL

How to access Library, File, and Field descriptions in DB2?

I would like to write a query that uses the IBM DB2 system tables (ex. SYSIBM) to pull a query that exports the following:
LIBRARY_NAME, LIBRARY_DESC, FILE_NAME, FILE_DESC, FIELD_NAME, FIELD_DESC
I can access the descriptions via the UI, but wanted to generate a dynamic query.
Thanks.
Along with SYSTABLES and SYSCOLUMNS, there is also a SYSSCHEMAS which appears to contain the data you need. Please note that accessing this information through QSYS2 will restrict rows returned to those objects with which you have some access - the SYSIBM schema appears to disregard this (check the reference - for V6R1 it's about page 1267).
You also shouldn't need to retrieve this with a dynamic query - static with host variables (if necessary) will work just fine.