Hello,
I've finding myself going in loops trying to use Google App Script with the JIRA Rest API.
I want to search for an JIRA asset, to confirm that is if found, if it is update it with a new value. Problem is I just can't seem to search for it successfully. Repeatedly getting a 404 response.
I even tried my luck with Google Gemini, and that hasn't help me either.
If you can give me a nudge in the right direction I'd be really grateful, including to the actual JIRA cloud api documentation
https://mycomp.atlassian.net/rest/servicedeskapi/assets/workspace/<workspaceid>/v1/aql/objects?aql=objectTypeId%3D136%20AND%20Name%3D'ABC'"
const JIRA_AUTH_HEADER = `Basic ${Utilities.base64Encode(JIRA_USERNAME + ':' + JIRA_API_TOKEN)}`;
const options = {
method: 'GET',
headers: {
Authorization: JIRA_AUTH_HEADER
},
muteHttpExceptions: true
};
Hi,
i use in most cases this https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-aql-post
From the documentation
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
import json url = "https://api.atlassian.com/ex/jira/{cloudId}/jsm/assets/workspace/{workspaceId}/v1/object/aql"
headers = { "Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer <access_token>" }
query = { 'startAt': '{startAt}', 'maxResults': '{maxResults}', 'includeAttributes': '{includeAttributes}' }
payload = json.dumps( { "qlQuery": "objectType = Office AND Name LIKE SYD" } )
response = requests.request( "POST",
url, data=payload,
headers=headers,
params=query ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
In your code - you set the workspaceId ?
https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-assets/#api-rest-servicedeskapi-assets-workspace-get
BR
Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.