IN operator for JQL in Jira Rest API - jira

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)

Related

Problems using $select with $expand in Priority REST API

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.

Why use "?" instead of ":" in URL?

We can use
'PATCH /companies/:id' : 'CompanyController.find'
to update data.
One suggested me that I can use the alternative way:
'PATCH /companies/find?key=Value'
But I do not know what it works. Please explain me why we prefer ? mark than : mark in search path.
You can use either or. The biggest reason most people chose one or the other is just how they want to present the URL to the user.
Using a path variable (:) can symbolize you're accessing a defined resource, like a user ID, where as an argument (?) can symbolize you're are dynamically changing/searching something within a defined resource, like a token or search term.
From what I can tell that's the general practice I see:
example.com/user/:username
versus
example.com/user/?search="foo"
http://en.wikipedia.org/wiki/URL
If we are firing GET request, ? symbol is used to let the server know the url parameter variables starts from there. And this is commonly used. I didn't used : symbol instead of ?
You are probably messing the things up:
According to your example, :id indicates a variable that must me replaced by an actual value in some frameworks such as Express. See the documentation for details.
And ? indicates the beginning of the query string component according to the RFC 3986.
It's a rule to design rest api
you can find 'how to design a rest api'
Assuming below code is Sails.js
'PATCH /companies/:id' : 'CompanyController.find'
It will makes REST API that be mapped onto 'CompanyController.find' by using PathParam. Like this
www.example.com/companies/100
Second one will makes REST API by using QueryParam.
It also be mapped onto 'CompanyController.find'
/companies/find?key=Value
But the API format is different. Like this
www.example.com/companies/find?key=100
PathParam or QueryParam is fine to make REST API.
If the Key is primary for company entity,
I think PathParam is more proper than QueryParam.

How can I get request parameters from REST style URL in thymeleaf?

In the thymeleaf documentation there's only option to get request parameters from urls which looks like,
https://example.com/getUser?id=10
I can use ${param.id[0]} to access the user id in thymeleaf whereas if I have a REST-style url like this,
https://example.com/user/10
How can I access the user id(10) in the page using thymeleaf with the above URL? Of course I can set a model attribute to access the id of user in the page. But just wondering if there any better way to do this in thymeleaf in order to minimize the code?
Well there is no direct helper AFAIK but your best shot is something like this:
${#strings.listSplit(#httpServletRequest.requestURI,'/')[1]}
note that 1 which is the list index of splitted url varies according to your url structure.
Note that #httpServletRequest.requestURI gives you user/10 and listSplit gives you [user, 10]

Passing an URL with parameters in Google Charts API

I want to generate a QrCode image with the Google Chart API. The QrCode encloses an URL with multiple parameters
http://example.com/page.php?param=nothing&param2=nothing
The Google Chart URL to generate this code would be
http://chart.apis.google.com/chart?cht=qr&chs=230x230&choe=UTF-8&chld=L&chl=*http://example.com/page.php?param=nothing**&param2**=nothing*
But this doesn't work. Obviously, the browser consider param2 to be part of the original URL.
Any hack to solve this?
Check out this flex example out. Full call looks like this:
https://www.google.com/jsapi/chart?cht=bvs&chs=500x500&chd=t:100,200,300,400,500,600,700&chds=0,700&chl=Savings|Checking|Money Market|Taxable Stocks|Taxable Bonds|IRA|Pension

How does a website know the Google query I used to find it?

When I search for something such as "rearrange table columns in asp.net" on Google, and click the link to Wrox's forum site, the site greets me with a message such as "Your Google search for 'rearrange table columns in asp.net' brought you to Wrox Forum...".
How does a site know what query I typed into Google? And how could I add such an ablity to my site?
It is parsing your query from the query parameters in the HTTP_REFERER server variable, which contains the URL you're coming from and is provided in your HTTP request.
It uses a header known as the "HTTP referrer". See http://en.wikipedia.org/wiki/HTTP_referrer
To use it in your site, you would need some kind of dynamic page generation, such as ASP / ASP.NET, PHP, or Perl. For example in Perl, you could do something like:
if ($ENV{HTTP_REFERER} =~ /google.com\?.+&q=(.+?)&/)
print "Your google search of $1 brought you to this site";
WARNING: The code above is only an example and may not be correct or secure!
Like these guys are suggesting, it's the HTTP_REFERER header variable. The query is in the "q" key in the URL. So if you want to parse that, you can just sort out the querystring and URL decode the "q" variable.
It looks at the referrer header. Here is some fairly basic PHP code to do it.

Resources