Am i sending a request to
https://recreate.atlassian.net/rest/api/2/search?jql=project=CD20015
I have tried multiple variations of this with spaces, quotes etc.
Nothing I have tried so far seems to work and everyone on the forum keeps posting it like this.
I always get >8000 results!
Maybe we need to do URL encoding for the param "project=CD20015". can you try following link
https://recreate.atlassian.net/rest/api/2/search?jql=project%3DCD20015
Also, please make sure that given "CD20015" is one of your projects in https://recreate.atlassian.net/ this account .
So i have identified a part of the issue, which was that the parameters were not correctly being added.
Ah ok so I get it now, in GuzzleHttp you add parameters from an array but when passing parameters the & is added between the jql= and project= parameters thus causing the syntax error.
Problem is that you cannot add ?jql= to the end of your url because they will be overwritten by anything in the paramter url, but I have to figure something out to get it right.
Ok this works:
https://recreate.atlassian.net/rest/api/2/search?jql=project=WVEC&verify=0
This doesn't work, but this what the url in php beecomes:
https://recreate.atlassian.net/rest/api/2/search?jql=%3D&project=WVEC&verify=0
"Error in the JQL Query: Expecting a field name but got '='. You must surround '=' in quotation marks to use it as a field name. (line 1, character 1)"
I am not even using quotations in the first one and it works fine without any.
Anyway thanks for your help, I didn't realize I could just paste the url in the browser.
In the browser it does actually show the jql syntax error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No that didn't change any, also notice how it just says max results 50 but still returns thousands.
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 50,
"total": 8946,
"issues": [
{
.... etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
oops, Sorry. I assumed that you either didn't get any result at all or get >8000 results both and answered first part only.
If you want to restrict maximum results you can use maxResults param. For example If I want to get 30, then your url should be
https://recreate.atlassian.net/rest/api/2/search?jql=project=CD20015&maxResults=30
But I am sure that you wouldn't get more than 50 when you didn't give the maxResults param. If you are using this backed program, please make sure that someone didn't change this param.
You can ensure that you didn't get more than 50 records by copy-pasting your url into browser(with your login) and parse that json, then count the records.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But it is indicating that it already has max results on 50.
And your url still appears to not be working for me.
Do you have an example of what you use yourself?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>But it is indicating that it already has max results on 50.
Yeah, agreed. Then you are getting only 50 records.
>>Do you have an example of what you use yourself?
Yeah, I have a demo project. I check the response for three different cases and every thing is working as it is.
case 1) without maxResults (got 50 issues as response)
case 2) with maxResults=1 (got only one issue as response)
case 3) with maxResults=60 (got 60 issues as response)
Please answer the following question to debug further.
How are you saying that you got more than 8000 results? I mean, are you counting length of "issues" field in response json, or some other measurement?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To make sure that you are getting only 50 issues as response,
Please find the total occurrences count for "project" (search along with double quotes) in your response. If you search other keys like "id","status" and etc will give you more count, because sub-resources like "priority","issuetype" also have those keys.
for example:
{"issues":
[
{"id": 101, "project":...., "priority": { "id": "priority1", "name":"Medium"}
{"id": 102, "project":...., "priority": { "id": "priority2", "name":"High"}
}
if you search "id" you will get 4 instead of 2, because there is a sub-resource named "priority" also have the "id".
So uniq field is "project". if you search a project it will give you the valid count.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.