I'm currently working on integrating with a company's API, and I am able to hit their Order Retrieval endpoint in PostMan, getting a 200OK status, but in my java app, I've tried hitting the endpoint with OkHttp3, Unirest, and even my own HttpReq library, but no matter which library I use, I end up getting
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
The headers, params, url for my java HttpRequest and PostMan are identical, as I copied the URL, params, headers from the result of printing out all the variables in Java, into PostMan. I've even tried using the Java snippets PostMan provides (HttpOk3/UniRest), but am still getting a 504. I've also tried setting timeouts to infinity, etc. What could I be doing wrong?
Here's the java HttpRequest I made with Unirest:
try {
Unirest.setTimeouts(30000, 100000);
HttpResponse<String> response = Unirest.get(this.getOrderUrl)
.queryString("access_token", config.getAccessToken())
.queryString("id", circleGraphicsOrderId)
.header("content-type", "application/json")
.header("cache-control", "no-cache")
.header("authorization", "Basic Og==")
.asString();
} catch (UnirestException e) {
e.printStackTrace();
}
Here's the API credentials if any of you would like to test with me:
(Params built into the url) URL = https://rest.cgorders.com/api/orders/order?access_token=97484431a4525ed2b294b699a3d2f202&id=15755354
The Params were: {access_token:97484431a4525ed2b294b699a3d2f202, id:15755354}
EDIT: Resolved! I was using wacky HttpRequest Libraries because our company code had a bunch of use cases with such libraries. Using the java provided one as Markspace wrote below resolved the issue.