Hi
I am attempting to POST data from a Groovy Script to an external REST API. The external API requires the data to be in the format:
http://someSite/someAPI/SomeAction?AuthToken=S_AUTH_TOKEN&domainName=aS_DOMAIN&PRODUCT_NAME=S_PRODUCT_NAME&input Data=[{"RequestAction":"S_RA", "Subject":"A Subject","accounts":[{"name":"John Doe","firstName":"John","lastName":"Doe" },{"name":"Jane Doe","firstName":"Jane","lastName":"Doe" }]}]
In order to achieve this, I am using an HTTPBuilder:
def baseURL = "http://someSite/someAPI";
def baseAction = "/SomeAction";
def httpBuilderRequest = new HTTPBuilder(baseURL + baseAction);
httpBuilderRequest.request(POST) {
requestContentType = ContentType.JSON
body = [AuthToken: "S_AUTH_TOKEN"
, PRODUCT_NAME: "S_PRODUCT_NAME"
, domainName: "S_DOMAIN"
, inputData:
[{RequestAction:"S_RA", "Subject":"Some Subject", accounts: [{"name":"John Doe","firstName":"John","lastName":"Doe" }]}]
]
response.success = {resp, JSON ->
}
response.failure = {resp, JSON ->
}
}
The "accounts" data is derived from a Jira issue obtained earlier, but that is not the issue. I have tried:
Is there perhaps anyone who could assist with a solution to this problem (Jira Server 8.19.9 is being used)
Thank you in advance
Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.
Register today!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.