Menu
  • HOME
  • TAGS

How to fix urlConnection.getResponseCode = 403

android,json,http-status-code-403,urlconnection,http-response-codes

When I try to load the URL you provided in the question, it says that HTTPS is required. Using Firebug, I confirmed that the server is in fact returning 403 in this case. Changing the protocol from http to https returns the JSON as expected. So, in your code, when...

Why does furthur execution halts after HttpResponse response=client.execute(request) line? [duplicate]

android,apache,api,http-response-codes

Your error is clear 2-22 14:18:59.448: W/System.err(1335): android.os.NetworkOnMainThreadException It simply means you are making network calls on main thread (UI thread). Use AsynTask to make network calls. see this http://developer.android.com/reference/android/os/AsyncTask.html Another good example is http://www.javasrilankansupport.com/2012/11/asynctask-android-example-asynctask-in.html...

UrlFetchApp Google Script - Rate Limit Error to Nest Thermostat - Response Code 429

json,google-apps-script,urlfetch,http-response-codes

I only ran into the "Too many requests" error during development when I was testing that same script. I was able to get this function to run hourly no problem, even every 5 minutes. To get this script run as expected on a trigger just switch the getData() to a...

Http response codes not changing, calling die() acceptable?

php,api,httpresponse,http-response-codes

Yes, ending the script after setting proper response headers is generally the proper action. I'm not sure why it is not working for you without explicit die - make sure you're not outputting any data or headers afterwards that shouldn't be there.

Http Response Code for Expected Server Error

http,exception-handling,http-response-codes

HTTP response codes should only reflect the status of the request itself. Something like a spam filter is endemic to the workings of your application, and has no bearing on the status of the HTTP request and response. Similar question here: How to show the internal server errors to the...

http_response_code() always returns 200, even on 404

php,apache,.htaccess,http-response-codes

As @Boaz said, PHP doesn't know what Apache is going to set later. You could use this approach to use the error code in PHP: ErrorDocument 400 /error.php?error=400 ErrorDocument 401 /error.php?error=401 ... And in PHP test $_GET["error"]....

Web API Action Filter to handle empty sets & 404's

c#,asp.net-web-api2,http-response-codes

It is possible with an action filter like this: public class EventsFilter : ActionFilterAttribute { public EventDBContext EventDBContext { get; set; } public override void OnActionExecuting(HttpActionContext actionContext) { bool exists = false; var routeData = actionContext.Request.GetRouteData(); object value; if (routeData.Values.TryGetValue("id", out value)) { int id; if (int.TryParse(value, out id)) {...