Jira Cloud: GET and CREATE Team with script

Originally asked by Oleksandra Honcharenko on 06 July 2022 (original question)


Hello. I am working with Jira Cloud and I need to synchronise the Team field(as I understand this field is from Portfolio, also it`s locked in the configuration menu). Customers want it to be dynamic: when we add new Team to another project(on the ADO side) and this new Team is added to a synchronised issue we should be able to fetch all Teams on Jira side to search for new Team and if script can`t find new Team it should add it to Jira.
I tried some API requests (like GET /rest/api/3/field/{fieldId}/context/{contextId}/option)but they don`t work. How can I do this?


[Failed to download attachment: attachment_58491970_114229_Screenshot+from+2022-07-05+00-33-23.png. Error: 401 Client Error: for url: Service Management]

[Failed to download attachment: attachment_58491970_114230_Screenshot+from+2022-07-05+00-34-40.png. Error: 401 Client Error: for url: Service Management]

[Failed to download attachment: attachment_58491970_114231_Screenshot+from+2022-07-05+12-19-40.png. Error: 401 Client Error: for url: Service Management]

Answer by Jose Pablo Alpizar Hidalgo on 13 July 2022

Please reference the following article to review the scrip details:
https://docs.idalko.com/exalate/x/iQR1Aw
and let mw know if it’s helpful.