I'm trying to access an application's API to return information. When calling directly in the browser I can see your answer, however when executing the call of the URL in a groovy scripy I don't get a return.
The return status code is 202, indicating that the request has been accepted for processing, but has not yet been completed. Does this indicate that I cannot get an answer, even if the method is GET? Or, why am I not getting the answer? Are there any details that must be inserted in the request?
The Groovy request is:
def getQueryInfo = new URL("URL").openConnection(); getQueryInfo.setRequestMethod("GET"); getQueryInfo.setRequestProperty("Content-Type", "application/json") getQueryInfo.setRequestProperty("X-Session", obj1.id) def getResponsetQueryInfo = getQueryInfo.getResponseCode(); //getResponsetQueryInfo return code 202 //set up response def queryCard= new JsonSlurper(); def resultQueryCard = queryCard.parseText(getQueryInfo.getInputStream().getText()); I believe that there is a way to obtain the answer, because in the browser, when executing the URL, the answer is obtained. Or if there is really nothing I can do to get the answer.
Any tips will be of great help.
https://stackoverflow.com/questions/66592763/how-to-get-api-get-call-response-with-return-code-202 March 12, 2021 at 09:06AM
没有评论:
发表评论