0

I am trying to do a very basic get request to an api. When I try to execute through Salesforce, I am getting a 404 error. If hit exact same api through Postman, I am getting through and receiving the json response with no issue. The site has been added to the list in Salesforce and I already have other code that posts to the API with no issue. The token is passed through the url and so is the record id I am querying. Again this works fine in Postman but not in Saleforce, and I'm copying and pasting to ensure no typos. Here is the code snippet below. What am I forgetting?

HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('url here');
req.setMethod('GET');
res = http.send(req);
System.debug(res.getBody());

And response:

12:45:38:250 CALLOUT_RESPONSE [9]|System.HttpResponse[Status=Not Found, StatusCode=404]

4
  • URL incorrect? 404 would indicate URL not found
    – Eric
    Commented Mar 3, 2017 at 20:22
  • Headers? Is there any headers in postman? like application/json etc?
    – kurunve
    Commented Mar 3, 2017 at 20:32
  • Bah, nvm this was figured out. I was being given the wrong parameters so it was trying to pull all the records from the table instead of the one I was trying to pass in the parameter. Thanks for looking.
    – dcoder
    Commented Mar 3, 2017 at 20:38
  • 1
    dcoder - post an answer please so this question doesn't show up as unanswered within the community
    – cropredy
    Commented Mar 4, 2017 at 21:14

1 Answer 1

-2

This kind of issues happen that the endpoint may not exposed to make a call from Cloud/Internet. Please check with Service provider that you can make call from Cloud/internet.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .