Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't connect google app script

Sandy Hsieh September 22, 2025

 Hello, I’m using the Jira Cloud REST API /rest/api/3/search/jql and constructed the payload as per the documentation:

 {
  "queries": [
    {
      "query": "assignee IN (\"accountId\") AND statusCategory IN (\"To Do\",\"In Progress\")",
      "startAt": 0,
      "maxResults": 50,
      "fields": ["assignee","summary","status","updated"]
    }
  ]
}

However, the API returns a 400 “Invalid request payload” error.
Does /search/jql not support the fields property? How should I correctly specify the fields to be returned?

1 answer

0 votes
Matteo Vecchiato
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 22, 2025

Hi @Sandy Hsieh 

Thank you for your question.

The payload has not a valid format.
The body, using the POST request of /rest/api/3/search/jql should be more similar to:

{ 
"fields": [ "assignee","summary","status","updated"],
"fieldsByKeys": false,
"jql": "assignee IN (\"accountId\") AND statusCategory IN (\"To Do\",\"In Progress\")",
"maxResults": 50,
"nextPageToken": "<string>",
}


The "nextPageToken" is used for pagination. You can find detail doc here 

I hope it helps

Sandy Hsieh September 22, 2025
Hi @Matteo Vecchiato 
Thank you for your reply
Could you help me take a look is it correct ?

const assignees = [
'"712020:83979f4e-28e0-457a-913c-95f21f9c1242"',
'"712020:4dddcd09-3250-4a73-a721-f9e03f26c5e8"'
];


const
jql = `assignee IN (${assignees.join(",")}) AND statusCategory IN ("To Do","In Progress") AND updated >= -2d ORDER BY created DESC`;

 

const payload = {
fields: ["assignee", "summary", "status", "updated"],
fieldsByKeys: false,
jql: jql,
maxResults: 50,
};

 

try {
const response = UrlFetchApp.fetch(url, {
method: "post",
headers: {
"Authorization": "Basic " + Utilities.base64Encode(email + ":" + apiToken),
"Accept": "application/json"
},
contentType: "application/json",
payload: JSON.stringify(payload),
muteHttpExceptions: true
});

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events