Forum Discussion
JIRA API 400 Bad Request
Good morning/afternoon/evening 🙂
I've been connecting to the JIRA API for some time now and it's been working fine up until now, where I am getting a bad request error. I have not changed anything in the code that makes the request to Jira. I have connected with the API key and checked that the projects, fields and custom fields all still exist in Jira, which they do. Can anyone identify what could be causing the error?
I have replaced the company name to keep it anonomised. Any help will be greatly appreciated!!
let
BaseUrl = "https://ANONCOMPANY.atlassian.net/rest/api/3/search?jql=project in ('BIM', 'BCM')&fields=key,statuscategorychangedate,customfield_10076,resolution,lastViewed,priority,assignee,status,creator,reporter,issuetype,project,resolutiondate,created,updated,customfield_10091,customfield_10095,customfield_10129,summary,customfield_10085,customfield_10086,customfield_10087,customfield_10070,customfield_10078,customfield_10090,description,customfield_10132,customfield_10088",
JiraIDPerPage = 100,
GetJson = (Url) =>
let
RawData = Web.Contents(Url),
Json = Json.Document(RawData)
in Json,
GetJiraIDCount = () =>
let Url = BaseUrl & "&maxResults=0",
Json = GetJson(Url),
Count = Json[#"total"]
in Count,
GetPage = (Index) =>
let Skip = "&startAt=" & Text.From(Index * JiraIDPerPage),
Top = "&maxResults=" & Text.From(JiraIDPerPage),
Url = BaseUrl & Skip & Top,
Json = GetJson(Url),
Value = Json[#"issues"]
in Value,
JiraIDCount = List.Max({ JiraIDPerPage, GetJiraIDCount() }),
PageCount = Number.RoundUp(JiraIDCount / JiraIDPerPage),
PageIndices = { 0 .. PageCount - 1 },
Pages = List.Transform(PageIndices, each GetPage(_)),
JiraID = List.Union(Pages),
3 Replies
- amitchandakSuper User
- AmyMisaFrequent Visitor
Hi - thanks! not sure why it would stop accepting 'in' as it was working up to this point in time. I have taken it out and tried = instead and nothing but no luck
- v-luwang-msftCommunity Support
Hi AmyMisa ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.
Best Regards
Lucien