2
Eai guys, I’m having a hard time understanding why is giving gateway timeout in a request, since I tested by Curl and was normal, I’m using Basic Auth. Follows:
var authorization = "apikey:";
HttpWebRequest wbRequest = (HttpWebRequest)WebRequest.Create("https://api.konduto.com/v1/orders/0");
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
wbRequest.Headers["Authorization"] = string.Format("Basic {0}", authorization);
wbRequest.Method = "GET";
var response = (HttpWebResponse)wbRequest.GetResponse();
var stringFinally = "";
using (var reader = new StreamReader(response.GetResponseStream()))
{
stringFinally = reader.ReadToEnd();
}
When I give getresponse it comes back to me :
The remote server returned an error: (504) Gateway Timeout.
I wonder if anyone has already been through this and how I could solve, because via Curl the GET works normal.
wbRequest.Timeout = timeout;
should work.– stderr
The problem seems to be the location accessed (maybe you have some difficulty because of your internet). The timeout default is 100 seconds, I already think a lot. It may be the way to use but only with this information can not know. The code seems to be okay with this (as always most of the codes posted here do not do everything they should to be robust, but this is something else). Have you tried to access without this code? I have my doubts if this authorization is necessary. I used with nothing and was.
– Maniero
I tried to do a test, I don’t know if there is any problem with the environment I have but if I access in the browser without passing an API key returns an immediate result. Without trying for code without authorization, it gives authorization error. It doesn’t make much sense since the browser works. And really when you put the authorization he can’t return anything in a timely manner. This indicates that this type of authorization is causing a problem. See the documentation for any other way to do this. It is complicated to answer questions about very specific Apis.
– Maniero
@Wisneroliveira erases this quickly. Unless this is temporary, don’t worry (even) about posting private information on the Internet. With Curl do you pass this key to and do the authorization process or not? This looks like their problem or misuse of the API, I don’t know if anyone here could help. They provide support?
– Maniero
@bigown a key is temporary, I revoke it and I get another and yes I pass via Curl too, follow script: Curl -u "apikey" -X GET "https://api.konduto.com/v1/orders/0"
– Wisner Oliveira
Ever tried to use
HTTPClient
?– Maniero
@bigown yes, I’ve tried.
– Wisner Oliveira
@bigown the return when exiting by Curl comes like this : {"status":"error","message":{"Where":"/","Why":{"expected":"order (0) to exist","found":"order (0) does not exist"}} certinho
– Wisner Oliveira
It’s what I got for the browser without authorization, without anything. That’s why it’s weird. Because I think there is something wrong with using the API, you probably have to pass something else to work. But on the other hand it should work without authorization too, it works in the browser.
– Maniero
@bigown serious ? o. what return you get by browser ? the only return I get from the browser is this : {"status":"error","message":{"Where":"/","Why":{"expected":"Authentic API key." ,"found":"Unauthentic API key."}}}
– Wisner Oliveira
Let’s go continue this discussion in chat.
– Wisner Oliveira
True, I’d forgotten. But in te this is a real return, it’s not a browser authorization error. Only you know what to do with it, the navigator doesn’t. Of course there may also be an authorization error I haven’t seen (I can’t see it now). I still think you’ll need specific support to see what’s left to send. But I have no experience with these components, so there might be an obvious problem that I’m not realizing.
– Maniero
I get it, I’m going to look for API support and see if there’s anything missing, thank you very much for your attention.
– Wisner Oliveira