Find your content:

Search form

You are here

503 error in rest api

 
Share

I am calling below webservice when i update the record in account object, trigger calling the webservice but when i used below webservice i am getting 503 error i am follwing the below link http://cheenath.com/?tutorial/sfdc/sample1/index.html it is working fine for me, when i change the url at that time i am getting 503 error what is the problem

public class AccountUpdater {


  @Future(callout=true)
  public static void updateAccount(String id, String name) {

    //construct an HTTP request
    HttpRequest req = new HttpRequest();
    req.setEndpoint('http://justsee.corp.aaaa.net/endpointurl.txt');
    req.setMethod('GET');

    //send the request
    Http http = new Http();
    HttpResponse res = http.send(req);

    //check the response
    if (res.getStatusCode() == 200) {

      //update account
      Account acc = new Account(Id=id);
      acc.Description = res.getBody();
      update acc;
    } else {
      System.debug('Callout failed: ' + res);
    } 
  }
}

Attribution to: Sathya

Possible Suggestion/Solution #1

The HTTP status numbers have specific meanings. For example your 503 means:

The Web server (running the Web site) is currently unable to handle the HTTP request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.

That suggests the problem is not at your end of the communication but at the other server end.

As this is a simple unauthenticated GET, you can just enter the URL in your browser and check the result you get there compared to the result you get in your Apex code. (Right now http://justsee.corp.aaaa.net/ does not appear to exist.)

Also note that you have to allow your org to access to the remote server via Setup -> Security -> Remote Site Settings.


Attribution to: Keith C
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30698

My Block Status

My Block Content