Problems using $select with $expand in Priority REST API - priority-web-sdk

Using the Rest API, I'm trying to use $select with $expand like this:
https://priority.company.biz/odata/Priority/tabula.ini/company/DOCUMENTS_D?$filter=CURDATE ge 2020-01-01 and CURDATE le 2020-01-31&$expand=TRANSORDER_D_SUBFORM&$select=CUSTNAME,CDES
I get a 500 error. It seems that these two operators don't work together. I tried each one of them separately and they work. Any insights?

from which programming lang do you call the rest service ? It works Ok if you use the rest date format
CURDATE eq 2020-04-28T00:00:00+00:00
when you call url with specical chars like + you must replace it for example + = %2B
from C# for example we use Uri.EscapeDataString(MyDateString) to combine the date in the URL

try this:
subform needs to be in paranthesis
and no & before subform's select
https://priority.company.biz/odata/Priority/tabula.ini/company/DOCUMENTS_D?$select=DOCNO,TYPE,CUSTNAME, CDES&$filter=CURDATE ge 2020-01-01 and CURDATE le 2020-01-31&$expand=TRANSORDER_D_SUBFORM

When combining $expand and $select features you must include in the $select parameter the key(s) of the upper-level form.
Your corrected URL:
https://priority.company.biz/odata/Priority/tabula.ini/company/DOCUMENTS_D?$filter=CURDATE ge 2020-01-01 and CURDATE le 2020-01-31&$expand=TRANSORDER_D_SUBFORM&$select=CUSTNAME,CDES,DOCNO,TYPE
Priority software added it to its documentation recently:
Note: When using the $expand command for a subform with composite keys, the $select command must include all key fields from the upper-level form
And I add: It is not only for composite keys but for all simple 'one-column' keys.

Related

IN operator for JQL in Jira Rest API

I would like to translate the following JQL query for an REST API call :
project=XX AND component IN ("SomeTitle")
first part of the url would be:
/rest/api/2/search?jql=project=XX
but how do I set the component IN ("SomeTitle") in the url ? What operator do I need to use ?
Here's what that URL would look like:
/rest/api/2/search?jql=project=XX%20and%20component%20in%20(%22SomeTitle%22)

odata Taking only the 1st record from an expanded set of child records?

Is there a way to specify that I only want to return the first record (or last) of a expanded set of child records using odata?
http://myurl/odata/ParenTable?$count=true&$filter=(Id eq 123456)&$expand=ChildTable($orderby=AddedTimeStamp desc;$top=1)
This is what I am attempting but it returns the message
The query specified in the URI is not valid
Your URL convention is compliant to OData v4 for the behaviour you are expecting.
11.2.4.2.1 Expand Options
The set of expanded entities can be further refined through the application of expand options, expressed as a semicolon-separated list of system query options, enclosed in parentheses.
Allowed system query options are $filter, $select, $orderby, $skip, $top, $count, $search, $expand, and $levels.
But there are older versions and proprietary implementations that are known to not support all or in some cases any of these options like filtering or limiting ($skip,$top) expressions within the $expand query option.
.Net implementations do not support $search OOTB, the API author must manually implement the query option.
That specific error is generally an indicator that the path component, not the query is invalid as most OData runtimes will return more descriptive error response when the resource or collection was correctly resolved but the query could not be parsed or executed. In this case I suspect you have anonymized the path, so we can only speculate, for instance there is an obvious potential typo in the documented path,
there is a 't' missing have you tried:
http://myurl/odata/ParentTable?$count=true&$filter=(Id eq 123456)&$expand=ChildTable($orderby=AddedTimeStamp desc;$top=1)
or is the resource pluralised:
http://myurl/odata/ParenTables?$count=true&$filter=(Id eq 123456)&$expand=ChildTable($orderby=AddedTimeStamp desc;$top=1)
http://myurl/odata/ParentTables?$count=true&$filter=(Id eq 123456)&$expand=ChildTable($orderby=AddedTimeStamp desc;$top=1)
You should include an example of the URL that does work, try without the $top and without the $orderby clauses within the expansion clause. We need to eliminate the errors related to a bad path, vs a bad query.
If you do this via Postman, you can then update your question and post the entire response content.
Both the current ASP.Net and ASP.Net Core implementations do support this, if you are the author of the API please include your controller implementation and the version of the framework you are using so we can assist in greater detail.
An Alternative
If your API does not support this, then given that you are limiting to the $top=1 you could invert the request and use the Child collection resource instead:
Assuming that ~/ChildTable is the route to the ChildTable referred to in your example expansion
http://myurl/odata/ChildTable?$filter=ParentTable/Id eq 123456&$orderby=AddedTimeStamp desc&$top=1&$expand=ParentTable

MicrosoftGraph querying for #microsoft.graph.downloadUrl returns character '#' is not valid

I have problem querying for "#microsoft.graph.downloadUrl" using microsoft graph endpoint.
Running a query like this:
https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id,name,file,folder,size,lastModifiedDateTime,#microsoft.graph.downloadUrl
Returns a bad request error with message: "Syntax error: character '#' is not valid at position..." I had not such a problem with OneDrive direct endpoint so I am wondering how exactly should I run the intended query?
Earlier this year the attribute #content.downloadUrl was renamed to #microsoft.graph.downloadUrl.It looks like there is an issue/discrepancy between the attribute's name in the results verse the query parameters.
The $select clause is still looking for the original name. As best I can tell, this isn't documented at the moment. That said, this query should do the trick for you:
/me/drive/root/children?$select=id,name,file,folder,size,lastModifiedDateTime,content.downloadUrl

Sql Server Full-Text Search with wild card suffix using Entity Framework 6 Interceptor

http://www.entityframework.info/Home/FullTextSearch
This example works fine for full word searches but does not talk about how to implement wild card suffix.
For example, I can do the following in SQL and get results for "bill" or "billy" using '*' in the end. How do I add that to my Interceptor?
select * from dbo.messagethread a
where contains(Text, '"bil*"')
If you look at that example code in that link above, I was thinking if something like this (below) is possible, but obviously that does not work as it is getting added to the parameter name not the value.
string.Format(#"contains([$1].[$2], #{0} *)", parameter.ParameterName));
There are questions like this one which talk about wildcards in full-text in SQL.
Look for this line in the example link provided in the question.
parameter.Value = value;
Then, to do prefix match, just add this line below that.
value = $"\"{value}*\""; // prefix match
We're basically changing the value of the parameter to have the * in it inside double quotes.
Now if you search for "bil", you get results for "bill"/"billy" and so on.

Using Breeze query not invoking action

I am developing single page application using HotTowel.
My question is that, When I am writing a Breeze query with string parameter whose length is greater than 1600 characters then action is not invoking.
Please let me know the reason.
Thanks in advance.
as stated in:
What is the maximum length of a URL in different browsers?
there is a limit for the length of urls
check parametrized queries as a possible workaround:
How to properly send action parameter along with query in BreezeJs
The answer from #fops is correct. Using .withParameters, you may be able to create some methods on your server that allow you to use some shorthand on the client instead of very large queries.
If your queries are really big, and even .withParameters blows up your URL, you may need to use POST instead of GET.
Breeze doesn't support POST for queries directly, but there's an (unsupported) add-on in Breeze Labs called breeze.ajaxpost.js that will let you use POST for .withParameters queries.

Resources